GitVersion: `dotnet build` command always fails with GitVersionTask 4.0.0-beta

When a totally new .NET Standard project is created and GitVersionTask is installed on it, dotnet build command certainly fails with this message below:

C:\Users\walterlv.nuget\packages\gitversiontask\4.0.0-beta0012\build\GitVersionTask.targets(49,5): error MSB4062: The “GitVersionTask.WriteVersionInfoToBuildLog” task could not be loaded from the assembly C:\Users\walterlv.nuget\packages\gitversiontask\4.0.0-beta0012\build\GitVersionTask.dll. Could not load file or assembly ‘Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL’. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\walterlv\Desktop\XxxYyyZzz\XxxYyyZzz\XxxYyyZzz.csproj]

The raw error message is here:

> dotnet build
Microsoft (R) Build Engine version 15.6.84.34536 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 42.12 ms for C:\Users\walterlv\Desktop\XxxYyyZzz\XxxYyyZzz\XxxYyyZzz.csproj.
C:\Users\walterlv\.nuget\packages\gitversiontask\4.0.0-beta0012\build\GitVersionTask.targets(49,5): error MSB4062: The "GitVersionTask.WriteVersionInfoToBuildLog" task could not be loaded from the assembly C:\Users\walterlv\.nuget\packages\gitversiontask\4.0.0-beta0012\build\GitVersionTask.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL'. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\walterlv\Desktop\XxxYyyZzz\XxxYyyZzz\XxxYyyZzz.csproj]

Build FAILED.

C:\Users\walterlv\.nuget\packages\gitversiontask\4.0.0-beta0012\build\GitVersionTask.targets(49,5): error MSB4062: The "GitVersionTask.WriteVersionInfoToBuildLog" task could not be loaded from the assembly C:\Users\walterlv\.nuget\packages\gitversiontask\4.0.0-beta0012\build\GitVersionTask.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL'. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\walterlv\Desktop\XxxYyyZzz\XxxYyyZzz\XxxYyyZzz.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.40

Fortunately, if I build it using msbuild.exe or Visual Studio 2017, it succeeds.

My environment:

  • Windows 10.0.16299.371
  • Visual Studio 2017 (15.6.6)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Is there a workaround or must I look for another library if I’ve run into this? I’m going to build it CLI in a docker container in my CI environment and msbuild does not exist there