MSBuild干净目录字符串 [英] MSBuild clean directory string
问题描述
我在MSBuild中有一个属性来表示MSBuildProjectDirectory上方的目录:
I have a property in MSBuild to represent the directory above the MSBuildProjectDirectory:
<PropertyGroup>
<BuildDir>$(MSBuildProjectDirectory)\..</PRSBuildDir>
</PropertyGroup>
然后我需要使用此属性,但是我需要清除目录字符串,以使其不包含..
.换句话说,我需要评估..
,以便如果当前项目文件位于C:\Test\Tom\MyDir
中,那么我需要一个包含字符串C:\Test\Tom
的属性.
I need to then use this property, but I need the directory string cleaned so that it doesn't include the ..
. In other words I need the ..
evaluated, so that if the current project file is in C:\Test\Tom\MyDir
, then I need a property containing the string C:\Test\Tom
.
我问的原因是因为我试图运行这样的命令:
The reason I'm asking is because I'm trying to run a command like this:
msiexec /passive /i "D:\Build\2.3.84.40394\Deployment\..\Vendor\LogParser.msi"
但是它正在抱怨通往msi的路径:This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package.
But it's complaining about the path to the msi: This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package.
推荐答案
有一个 ConvertToAbsolutePath任务,有什么用吗?
这篇关于MSBuild干净目录字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!