每当更新nuget包时自动更新依赖版本n nuspec [英] auto updating the dependency version n nuspec whenever update nuget package

查看:179
本文介绍了每当更新nuget包时自动更新依赖版本n nuspec的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个取决于另一个np的nuget包。当我在我的np代码中更新外部np时,我希望新版本(外部np)在我的nuspec中自动
更新。 因此,当我发布我的np时,它会采用最新的外部np 我用过。

是否可以选择在visual studio中自动执行此操作或每次必须手动更新nuspec?

目前,当客户端更新我的np时,他们还必须明确更新外部np。 我希望当客户端更新我的np时,它应该自动更新
外部np(我的np所依赖的)。

谢谢

推荐答案


嗨朋友,

Hi friend,

由于 .nuspec文件是手动生成
,.nuspec中的默认版本是1.0.0.0,当您更新np代码中的外部np时,您必须手动更新版本
.nuspec。

Since the .nuspec file is generated manually and the default version in the .nuspec is 1.0.0.0,  when you update the external np in your np code, you have to manually update the version in the .nuspec.

但是你可以选择一个替代方案,你可以通过以下命令直接打包
.csproj文件而不是.nuspec文件:

But there is an alternative you can choose, you can pack the .csproj file directly instead of the .nuspec file by following command:

nuget.exe pack" YouProjectName.csproj"

在这种情况下,创建的nuget包将自动包含程序集版本。因此,当您更新np代码中的外部np时,您只需要在
下的 AssemblyInfo.cs 文件中更新
AssemblyVersion 解决方案资源管理器中的属性
节点。

In this case, the created nuget package will include the assembly version automatically. So when you update the external np in your np code, you just need update the AssemblyVersion in the AssemblyInfo.cs file under Properties node in the solution explorer.

注意:更改版本后,请先构建项目,然后运行上面的命令。

Note: After changing the version, please build your project first then run the command above.

 

问候,

Fletcher


这篇关于每当更新nuget包时自动更新依赖版本n nuspec的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆