Skip to content

Commit

Permalink
Set AssemblyVersion to major version (#531)
Browse files Browse the repository at this point in the history
Addins are backwards compatible to latest major version.
Since we are using project references, we need to fix assembly version to the latest
major version to avoid requiring exact minor versions at runtime.
  • Loading branch information
pascalberger authored Apr 15, 2024
1 parent 1fc4a02 commit b261a96
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions recipe.cake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@ ToolSettings.SetToolSettings(
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");

//*************************************************************************************************
// Setup
//*************************************************************************************************

Setup(context =>
{
// Addins are backwards compatible to latest major version.
// Since we are using project references, we need to fix assembly version to the latest
// major version to avoid requiring exact minor versions at runtime.
var settings = context.Data.Get<DotNetCoreMSBuildSettings>();
var version = new Version(settings.Properties["AssemblyVersion"].First());
settings.Properties["AssemblyVersion"] = new List<string> { $"{version.Major}.0.0.0" };

context.Log.Information("AssemblyVersion changed to {0}", settings.Properties["AssemblyVersion"].First());
});

//*************************************************************************************************
// Execution
//*************************************************************************************************
Expand Down

0 comments on commit b261a96

Please sign in to comment.