C # AssemblyVersion 3 digits for use with NuGet PreRelease version
In AssemblyInfo.cs
:
[assembly: AssemblyVersion("1.0.*")]
Will generate a 1.0.x.x
four digit version number.
What if I use this nuspec metadata:
<version>$version$-test</version>
generates a packing error:
The version Β« 1.0.5431.31092-test Β» does not follow semantic version control instructions
Is there an easy way to get around this?
source to share
Not possible, the version of the assembly is stored in the System.Version class, which consists of Major, Minor, Build and Revision.
EDIT: I was a bit rushed to answer. When you use the AssemblyVersionAttribute constructor with a string containing asterix, all four version properties will be generated. The only way to call the version with lower numbers is to specify the exact version number without the asterix, i.e. "1.0.1". See: http://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute.assemblyversionattribute(v=vs.110).aspx
What you could do if you want fewer version numbers, as well as the generated version numbers, is to use an external tool to change the version numbers during pre-build.
source to share
No messaging needed, NuGet
use [assembly: AssemblyInformationalVersion("")]
as package version, install it on any number of components you like and do with it.
PS I highly recommend you install as well AssemblyVersion
, as this is the one that actually uses .NET, at least to auto-increase
Some reading is available here
Complete example
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyInformationalVersion("1.0")]
A package will be generated Lib.1.0.nupkg
containing the assembly with version 1.0.xx, with the version you will be dealing with -1.0
Whenever you want to change nuget version, just change AssemblyInformationalVersion
, not touch AssemblyVersion
at all
source to share