What are the options for setting a project version with .NET Core / ASP.NET Core projects?
Found so far:
Set the
versionproperty inproject.json. Source: DNX Overview, Working with DNX projects. This seems to set theAssemblyVersion,AssemblyFileVersionandAssemblyInformationalVersionunless overridden by an attribute (see next point).Setting the
AssemblyVersion,AssemblyFileVersion,AssemblyInformationalVersionattributes also seems to work and override theversionproperty specified inproject.json.For example, including
'version':'4.1.1-*'inproject.jsonand setting[assembly:AssemblyFileVersion("4.3.5.0")]in a.csfile will result inAssemblyVersion=4.1.1.0,AssemblyInformationalVersion=4.1.1.0andAssemblyFileVersion=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.