我的项目需要打包成一个zip文件进行部署。我想在post构建步骤中创建这个zip文件。
为此,我通过NuGet安装了一个7-Zip命令行包。此包提供了一个可执行文件,我想在post构建步骤中调用它。我知道我可以通过提供已安装包的路径来调用它,但是这个路径包含包的版本号,所以在更新包时,直接引用会中断。
是否有一些MSBuild变量可用于获取已安装包的工具路径的路径?
发布于 2014-07-22 22:31:00
我认为没有办法避免包路径中的版本号,但是您可以做一些类似于SlowCheetah nuget包所做的事情,以使它在开发人员机器之间更加可移植,等等。
<PropertyGroup Label="SlowCheetah">
<SlowCheetahToolsPath>$([System.IO.Path]::GetFullPath( $(MSBuildProjectDirectory)\..\packages\SlowCheetah.2.5.12\tools\))</SlowCheetahToolsPath>
<SlowCheetah_EnableImportFromNuGet Condition=" '$(SlowCheetah_EnableImportFromNuGet)'=='' ">true</SlowCheetah_EnableImportFromNuGet>
<SlowCheetah_NuGetImportPath Condition=" '$(SlowCheetah_NuGetImportPath)'=='' ">$([System.IO.Path]::GetFullPath( $(MSBuildProjectDirectory)\Properties\SlowCheetah\SlowCheetah.Transforms.targets ))</SlowCheetah_NuGetImportPath>
<SlowCheetahTargets Condition=" '$(SlowCheetah_EnableImportFromNuGet)'=='true' and Exists('$(SlowCheetah_NuGetImportPath)') ">$(SlowCheetah_NuGetImportPath)</SlowCheetahTargets>
</PropertyGroup>https://stackoverflow.com/questions/24868812
复制相似问题