如何更改或引用道具文件上的nuget软件包版本
我正在构建一个仅包含预制CLI工具的Nuget软件包,作为此软件包的一部分,我需要将此类工具移至引用它的项目的BIN文件夹。我正在通过在我的软件包中添加props
文件来实现:
<Project>
<ItemGroup>
<None Include="$(NuGetPackageRoot)/packageid/1.0.0.3/tools/*" Link="%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" ExcludeFromSingleFile="true" />
</ItemGroup>
</Project>
如您所见,我在路径中对软件包版本进行了硬编码,我真的不想做。
我计划使用Nuget Pack packageID -version 1.0.0.3
构建包装。
因此,是否有MSBUILD变量可以使用软件包版本或使用Nuget Pack
替换它的方法?
I am building a Nuget Package that will only contain a pre built CLI Tool and as part of this package I need to move such tool to the bin folder of the project that referenced it. I am accomplishing by adding a props
file to my package:
<Project>
<ItemGroup>
<None Include="$(NuGetPackageRoot)/packageid/1.0.0.3/tools/*" Link="%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" ExcludeFromSingleFile="true" />
</ItemGroup>
</Project>
As you can see, I have hardcoded the package version in the path, which I really don't want to do.
I am planning on building the package using nuget pack PackageId -version 1.0.0.3
.
So, is there an MSBUild variable that will use the package version or a way to replace it while using nuget pack
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过在打包之前使用 sed 命令替换版本号来完成同样的事情。我将其添加为我的 Azure Dev OPS 管道中的一个步骤
I have accomplished the same thing by replacing the version number using the
sed
command before packaging it. I added it as a step in my Azure Dev OPS pipeline