Reputation: 7036
When you are not using .Net Core you could define your Assembly version in AssemblyInfo.cs
like so [assembly: AssemblyVersion("2.1.3.*")]
. Note in particular the *
which means the default build number
In .Net core as far as I can tell the build number is set in the *.csproj
file. However, it appears to not like using an *
in version. It complains that version number is invalid.
<PropertyGroup>
<AssemblyVersion>2.1.3.*</AssemblyVersion>
</PropertyGroup>
I have raised an issue on the dotnet/cli project, but to no avail.
So my question is 'How to set default build number in .Net Core'?
Upvotes: 3
Views: 808
Reputation: 2245
The easiest thing to do is have your build system pass in the version on the CLI. For example if you were using powershell and appveyor you could pass dotnet build -c Release /p:Version=2.1.3.$env:APPVEYOR_BUILD_NUMBER
Upvotes: 3