-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
version: replace nerdbank with version file
Remove Nerdbank.GitVersioning dependency from project in favor of a new VERSION file, which will be updated ahead of each release. Versioning in this file will begin with the version we plan to use for the next release: 2.1.0.0. This change involves the addition of a new custom MSBuild task, which reads in the contents of the VERSION file, converts it to a Version object, and then sets the various version-related MSBuild properties with the correct value (some with the `Revision` component appended, others without). Note that there is a bug in MSAL [1] that causes build failures for projects without dependencies with this change. We add Newtonsoft.Json as a global dependency in Directory.Build.props to work around this problem until the fix is released. [1]: AzureAD/microsoft-authentication-library-for-dotnet#4108
- Loading branch information
1 parent
f1a235d
commit 6ab469f
Showing
9 changed files
with
71 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
using System.IO; | ||
|
||
namespace GitCredentialManager.MSBuild | ||
{ | ||
public class GetVersion : Task | ||
{ | ||
[Required] | ||
public string VersionFile { get; set; } | ||
|
||
[Output] | ||
public string Version { get; set; } | ||
|
||
[Output] | ||
public string AssemblyVersion { get; set; } | ||
|
||
[Output] | ||
public string FileVersion { get; set; } | ||
|
||
public override bool Execute() | ||
{ | ||
Log.LogMessage(MessageImportance.Normal, "Reading VERSION file..."); | ||
string textVersion = File.ReadAllText(VersionFile); | ||
|
||
if (!System.Version.TryParse(textVersion, out System.Version fullVersion)) | ||
{ | ||
Log.LogError("Invalid version '{0}' specified.", textVersion); | ||
return false; | ||
} | ||
|
||
// System.Version names its version components as follows: | ||
// major.minor[.build[.revision]] | ||
// The main version number we use for GCM contains the first three | ||
// components. | ||
// The assembly and file version numbers contain all components, as | ||
// ommitting the revision portion from these properties causes | ||
// runtime failures on Windows. | ||
Version = $"{fullVersion.Major}.{fullVersion.Minor}.{fullVersion.Build}"; | ||
AssemblyVersion = FileVersion = fullVersion.ToString(); | ||
|
||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.