我正在使用 MSBuildCommunityTasks 在构建时检索 git 提交哈希:
<GitVersion LocalPath="$(MSBuildProjectDirectory)">
<Output TaskParameter="CommitHash" PropertyName="GitRevision" />
</GitVersion>
MSBUILD 在我的本地计算机上按预期执行此任务,但在 Team Foundation Service 的 Hosted Build Controller 执行它时失败:
SalesApplication.Versioning.csproj (81): The "GitVersion" task failed unexpectedly.
System.Exception: Could not find git.exe. Looked in PATH locations and various common folders inside Program Files.
显然,根据已安装软件包的列表,TFService 使用的托管构建控制器无法直接访问 git.exe:http: //listofsoftwareontfshostedbuildserver.azurewebsites.net/
MSBUILD 如何检索托管构建控制器上的 git 提交信息?