static TaskProxy() { #if !NET461 GitLoaderContext.Init("GitVersionCore", "LibGit2Sharp"); #endif LibGit2SharpLoader.LoadAssembly("GitVersionTask"); var type = LibGit2SharpLoader.Instance.Assembly.GetType("GitVersionTask.GitVersionTasks", throwOnError: true).GetTypeInfo(); GetVersion = GetMethod <GetVersion>(type, nameof(GetVersion)); GenerateGitVersionInformation = GetMethod <GenerateGitVersionInformation>(type, nameof(GenerateGitVersionInformation)); UpdateAssemblyInfo = GetMethod <UpdateAssemblyInfo>(type, nameof(UpdateAssemblyInfo)); WriteVersionInfoToBuildLog = GetMethod <WriteVersionInfoToBuildLog>(type, nameof(WriteVersionInfoToBuildLog)); }
static TaskProxy() { try { #if !NETFRAMEWORK GitLoaderContext.Init(typeof(TaskProxy).Assembly); #endif LibGit2SharpLoader.LoadAssembly("GitVersionTask"); var type = LibGit2SharpLoader.Instance.Assembly.GetType("GitVersion.MSBuildTask.GitVersionTasks", throwOnError: true).GetTypeInfo(); GetVersion = GetMethod <GetVersion>(type, nameof(GetVersion)); GenerateGitVersionInformation = GetMethod <GenerateGitVersionInformation>(type, nameof(GenerateGitVersionInformation)); UpdateAssemblyInfo = GetMethod <UpdateAssemblyInfo>(type, nameof(UpdateAssemblyInfo)); WriteVersionInfoToBuildLog = GetMethod <WriteVersionInfoToBuildLog>(type, nameof(WriteVersionInfoToBuildLog)); } catch (Exception e) { InitialiseException = e; } }