-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- use GitVersion version number in About dialog - refactor getting version
- Loading branch information
1 parent
ea831a4
commit e27818e
Showing
4 changed files
with
34 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) 2016 SIL International | ||
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT) | ||
using System; | ||
using System.Reflection; | ||
|
||
namespace BuildDependency.Tools | ||
{ | ||
public static class Utils | ||
{ | ||
public static Tuple<object, string> GetVersion(string ns) | ||
{ | ||
// Access fields in GitVersionInformation that GitVersion creates at compile time | ||
var gitVersionInformationType = Assembly.GetCallingAssembly() | ||
.GetType(ns + ".GitVersionInformation"); | ||
if (gitVersionInformationType == null) | ||
return new Tuple<object, string>(null, string.Empty); | ||
var fullSemVer = gitVersionInformationType.GetField("FullSemVer"); | ||
var sha = gitVersionInformationType.GetField("Sha"); | ||
return new Tuple<object, string>(fullSemVer.GetValue(null), | ||
sha.GetValue(null).ToString().Substring(0, 7)); | ||
} | ||
|
||
} | ||
} | ||
|
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