Rank: Member
Groups: Registered
Joined: 8/20/2016(UTC) Posts: 24 Location: United Kingdom
Thanks: 2 times Was thanked: 2 time(s) in 2 post(s)
|
I'm using GitVersion to automatically version my code. Specifically, I use the GitVersionTask NuGet package that installs an MSBuild task to extract the version information during every build. One of the things this task does is to "inject" a static class called GitVersionInformation. I access this in my code for things like displaying the version string in the About box and emitting version strings to the log file. In fact, the first thing my code does is write out some version strings using NLog: Code:
[STAThread]
private static void Main(string[] args)
{
// Manage unhandled exceptions
Application.ThreadException += UnhandledThreadException;
AppDomain.CurrentDomain.UnhandledException += UnhandledException;
Log.Info("Git Commit ID: {fullCommit}", GitVersionInformation.Sha);
Log.Info("Git Short ID: {shortCommit}", GitVersionInformation.ShortSha);
Log.Info("Commit Date: {commitDate}", GitVersionInformation.CommitDate);
Log.Info("Semantic version: {semVer}", GitVersionInformation.SemVer);
Log.Info("Full Semantic version: {fullSemVer}", GitVersionInformation.FullSemVer);
Log.Info("Build metadata: {buildMetadata}", GitVersionInformation.FullBuildMetaData);
Log.Info("Informational Version: {informationalVersion}", GitVersionInformation.InformationalVersion);
// [other stuff elided for clarity]
}
Visual Studio is happy with this, and the code builds without issues - but not in NCrunch. In NCrunch, I get this: Quote: LocalServer.cs (99, 53): 'GitVersionInformation' is inaccessible due to its protection level LocalServer.cs (100, 53): 'GitVersionInformation' is inaccessible due to its protection level LocalServer.cs (101, 51): 'GitVersionInformation' is inaccessible due to its protection level LocalServer.cs (102, 52): 'GitVersionInformation' is inaccessible due to its protection level LocalServer.cs (103, 61): 'GitVersionInformation' is inaccessible due to its protection level LocalServer.cs (104, 57): 'GitVersionInformation' is inaccessible due to its protection level LocalServer.cs (105, 71): 'GitVersionInformation' is inaccessible due to its protection level
Protection level? Probably not correct. It's a static internal class and Visual Studio is perfectly happy to compile that code. I guess there's some subtlety I'm not seeing about the MSBuild task. Any advice? Thanks, Tim
|