[英]nuget: package version is not being updated
I'm trying to pack a new version of a custom NuGet package and when I use the pack
command I'm getting a .nupkg
file which has a version number that doesn't match with the one that I've specified in the .nuspec file
. 我正在尝试打包自定义NuGet软件包的新版本,当我使用
pack
命令时,我得到的是一个.nupkg
文件,该文件的版本号与我在中指定的版本号不匹配.nuspec file
。
Example: 例:
nuget pack mypackage.csproj -IncludeReferencedProjects -Prop Configuration=Release
.nuspec
file: .nuspec
文件:
<?xml version="1.0"?>
<package >
<metadata>
<id>mypackage</id>
<version>1.0.1</version>
<authors>me</authors>
<owners>me</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>blah</description>
<releaseNotes></releaseNotes>
<copyright>Copyright 2016</copyright>
<tags>tag1 tag2</tags>
<dependencies>
</dependencies>
</metadata>
</package>
I should get a file named mypackage.1.0.1.nupkg
, but I'm getting a file named mypackage.1.0.0.nupkg
instead 我应该得到一个名为
mypackage.1.0.1.nupkg
的文件,但我却得到了一个名为mypackage.1.0.0.nupkg
的文件。
I'm also getting the same result when I try to pack it by using the AssemblyInfo
data included in the Properties\\AssemblyInfo.cs
and declaring the version as a variable in the .nuspec
file: 当我尝试通过使用
Properties\\AssemblyInfo.cs
包含的AssemblyInfo
数据并在.nuspec
文件中将版本声明为变量时,将其打包时,也会得到相同的结果:
Properties\\AssemblyInfo.cs ... [assembly: AssemblyVersion("1.0.1")] ... Properties \\ AssemblyInfo.cs ... [assembly:AssemblyVersion(“ 1.0.1”)] ...
Should I look for another properties in my project to update my NuGet package? 我是否应该在项目中寻找其他属性来更新NuGet包?
SOLUTION: Ignored the .nuspec file and managed the package versions via .csproj 解决方案:忽略.nuspec文件,并通过.csproj管理软件包版本
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net451;net452</TargetFrameworks>
...
<AssemblyVersion>1.2.1</AssemblyVersion>
</Project>
Thanks in advance! 提前致谢!
I fell foul of this recent as well. 我也对这个最近犯规。 You need to use the Properties\\AssemblyFileVersion attribute to set the correct value for a nuget package
您需要使用Properties \\ AssemblyFileVersion属性为nuget包设置正确的值
[assembly: AssemblyFileVersion("1.0.1")]
I often forget to build my project so it doesn't update the version. 我经常忘记构建我的项目,因此它不会更新版本。
Well, I've finally managed to update my version by packing using the AssemblyInfo
version. 好了,我终于设法通过使用
AssemblyInfo
版本打包来更新我的版本。 It seems like my publishing process for this package is completely ignoring the .nuspec file and gets the version from the last compiled source. 看来我对此程序包的发布过程完全忽略了.nuspec文件,并从最后编译的源获取版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.