Path 如何查找NuGet软件包安装的可执行文件?

Path 如何查找NuGet软件包安装的可执行文件?,path,nuget,post-build-event,Path,Nuget,Post Build Event,我的项目需要打包为zip文件进行部署。我想在后期构建步骤中创建此zip文件 为了实现这一点,我通过NuGet安装了一个7-Zip命令行包。这个包提供了一个可执行文件,我想在我的后期构建步骤中调用它。我知道我可以通过提供安装包的路径来调用它,但此路径包含包的版本号,因此当包更新时,直接引用将中断 是否有一些MSBuild变量可用于获取已安装软件包的工具路径?我认为没有办法避免软件包路径中的版本号,但您可以像SlowCheetah nuget软件包那样,使其在开发人员机器之间更具可移植性,等等 &l

我的项目需要打包为zip文件进行部署。我想在后期构建步骤中创建此zip文件

为了实现这一点,我通过NuGet安装了一个7-Zip命令行包。这个包提供了一个可执行文件,我想在我的后期构建步骤中调用它。我知道我可以通过提供安装包的路径来调用它,但此路径包含包的版本号,因此当包更新时,直接引用将中断


是否有一些MSBuild变量可用于获取已安装软件包的工具路径?

我认为没有办法避免软件包路径中的版本号,但您可以像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>

$([System.IO.Path]::GetFullPath($(MSBuildProjectDirectory)\..\packages\SlowCheetah.2.5.12\tools\)
真的
$([System.IO.Path]::GetFullPath($(MSBuildProjectDirectory)\Properties\SlowCheetah\SlowCheetah.Transforms.targets))
$(缓慢的输入路径)