What are the options for setting a project version with .NET Core / ASP.NET Core projects?
Found so far:
Set the
version
property inproject.json
. Source: DNX Overview, Working with DNX projects. This seems to set theAssemblyVersion
,AssemblyFileVersion
andAssemblyInformationalVersion
unless overridden by an attribute (see next point).Setting the
AssemblyVersion
,AssemblyFileVersion
,AssemblyInformationalVersion
attributes also seems to work and override theversion
property specified inproject.json
.For example, including
'version':'4.1.1-*'
inproject.json
and setting[assembly:AssemblyFileVersion("4.3.5.0")]
in a.cs
file will result inAssemblyVersion=4.1.1.0
,AssemblyInformationalVersion=4.1.1.0
andAssemblyFileVersion=4.3.5.0
Is setting the version number via attributes, e.g. AssemblyFileVersion
, still supported?
Have I missed something - are there other ways?
Context
The scenario I'm looking at is sharing a single version number between multiple related projects. Some of the projects are using .NET Core (project.json), others are using the full .NET Framework (.csproj). All are logically part of a single system and versioned together.
The strategy we used up until now is having a SharedAssemblyInfo.cs
file at the root of our solution with the AssemblyVersion
and AssemblyFileVersion
attributes. The projects include a link to the file.
I'm looking for ways to achieve the same result with .NET Core projects, i.e. have a single file to modify.