我在 MSBuild 中有一个属性来表示 MSBuildProjectDirectory 上方的目录:
<PropertyGroup>
<BuildDir>$(MSBuildProjectDirectory)\..</PRSBuildDir>
</PropertyGroup>
然后我需要使用这个属性,但我需要清理目录字符串,以便它不包含..
. 换句话说,我需要..
评估,因此如果当前项目文件在 中C:\Test\Tom\MyDir
,那么我需要一个包含字符串的属性C:\Test\Tom
。
我问的原因是因为我试图运行这样的命令:
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.