Skip to content

Upgrade from 1.0.0-beta-62925-02 to 1.0.0-beta-63102-01 is causing error MSB4062: The "Microsoft.Build.Tasks.Git.LocateRepository" task could not be loaded from the assembly #123

Closed

Description

@michael-wolfenden

Issue

Upgrading the sourcelink package from 1.0.0-beta-62925-02 to 1.0.0-beta-63102-01 causes the following compilation error:

C:\Users\michaelw\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta-63102-01\build\Microsoft.Build.Tasks.Git.targets(20,5): error MSB4062: The "Microsoft.Build.Tasks.Git.LocateRepository" task could not be loaded from the assembly C:\Users\michaelw\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta-63102-01\build\..\tools\netcoreapp2.0\Microsoft.Build.Tasks.Git.dll. Assembly with same name is already loaded 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. [D:\github\StarWarsNames\src\StarWars.Names\StarWars.Names.csproj]

Repoducing

  1. Clone https://github.com/michael-wolfenden/StarWarsNames
  2. From the root of the repo run dotnet build .\src\StarWarsNames.sln (should succeed)
  3. Upgrade sourcelink from 1.0.0-beta-62925-02 to 1.0.0-beta-63102-01
  4. Run dotnet build .\src\StarWarsNames.sln (should fail with the message above)

Environment

> dotnet --info

.NET Core SDK (reflecting any global.json):
 Version:   2.1.300
 Commit:    adab45bf0c

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17134
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.300\

Host (useful for support):
  Version: 2.1.0
  Commit:  caa7b7e2ba

.NET Core SDKs installed:
  1.0.0 [C:\Program Files\dotnet\sdk]
  1.0.3 [C:\Program Files\dotnet\sdk]
  1.0.4 [C:\Program Files\dotnet\sdk]
  1.1.0 [C:\Program Files\dotnet\sdk]
  2.0.0 [C:\Program Files\dotnet\sdk]
  2.0.2 [C:\Program Files\dotnet\sdk]
  2.0.3 [C:\Program Files\dotnet\sdk]
  2.1.2 [C:\Program Files\dotnet\sdk]
  2.1.4 [C:\Program Files\dotnet\sdk]
  2.1.100 [C:\Program Files\dotnet\sdk]
  2.1.101 [C:\Program Files\dotnet\sdk]
  2.1.102 [C:\Program Files\dotnet\sdk]
  2.1.103 [C:\Program Files\dotnet\sdk]
  2.1.104 [C:\Program Files\dotnet\sdk]
  2.1.200 [C:\Program Files\dotnet\sdk]
  2.1.201 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.300 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Activity

  1. tmat commented on Jul 17, 2018

    @tmat
    Member

    Can you try to run dotnet build-server shutdown in between the step 2 and 3?

  2. michael-wolfenden commented on Jul 17, 2018

    @michael-wolfenden
    Author

    Running dotnet build-server shutdown fixed the issue, but I'm not sure how to proceed.

    Should I be running that command as part of my build script?

    Or is it just implicit knowledge that if you update sourcelink, you have to run this command as a once off?

  3. tmat commented on Jul 18, 2018

    @tmat
    Member

    If you upgrade any package that has custom build task it is generally a good idea to restart the build servers.
    The problem is that they have the assemblies that implement the tasks loaded from previous builds and without restarting them the new assemblies collide, unless the assemblies change their version.
    We don't change assembly versions of pre-release builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions