This question is very similar to Setting the version number for .NET Core projects, but not the same. Using the latest stable version of .NET Core at the time of writing (1.
dotnet build /p:AssemblyVersion=1.2.3.4
Does that work for you?
Passing /p:PropertyName=Value as arguments does not work for me (ASP.Net Core 2.0 Web App). I found the Manifest Versioning Build Tasks on marketpace: https://marketplace.visualstudio.com/items?itemName=richardfennellBM.BM-VSTS-Versioning-Task
In my case, the main key was /property:Version=1.2.3.4
. And the following command line did the job:
dotnet build SolutionName.sln -c Release /property:Version=1.2.3.4
This will override Assembly default version.
To answer your question straight: The new SDK for msbuild is auto generating an assembly info file. You can suppress that using msbuild directives (to see the it by sample: invoke dotnet migrate
on a project.json based project).
But let me tell you my handling: I had multiple projects sharing the same version. I added a version.props
file which contained a property group including a item named VersionPrefix
. This file I included via the csproj file (Include
statement). I also removed all AssemblyInfo.cs
files and let the SDK generate them for me.
I modify the version.props
file during build.