如何更改或引用道具文件上的nuget软件包版本

发布于 2025-01-19 16:00:47 字数 580 浏览 1 评论 0原文

我正在构建一个仅包含预制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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝眼泪 2025-01-26 16:00:47

我通过在打包之前使用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文