Skip to content

[GitVersionTask] MSB4175 when calling dotnet build on solution with multiple projects #1601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
charabaruk opened this issue Feb 21, 2019 · 1 comment

Comments

@charabaruk
Copy link

Found with GitVersionTask 5.0.0-beta1-72 using .NET Core SDK 2.2.102 (internal MSBuild 15.9.20+g88f5fadfbe).

Build failed on second project (of three) within the solution with the following error:

C:\Users\ccharabaruk\.nuget\packages\gitversiontask\5.0.0-beta1-72\build\functionality\GitVersionBuild.targets(6,5): error MSB4175: The task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" could not be loaded from the assembly "C:\Users\ccharabaruk\.nuget\packages\utilpack.nuget.msbuild\2.9.1\build\\netcoreapp1.1\UtilPack.NuGet.MSBuild.dll". Assembly with same name is already loaded [C:\Users\ccharabaruk\Repos\ONAMA\dependencies\sync-framework-dotnet\src\Northcloud.Sync.Engine\Northcloud.Sync.Engine.csproj]

My thought is that MSBuild inside dotnet CLI is using the same process for each project inside the solution file, so tries reloading the UtilPack.NuGet.MSBuild assembly which fails since it's already loaded into the process.

Full output from dotnet build:

Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 63.95 ms for C:\Users\ccharabaruk\Repos\ONAMA\dependencies\sync-framework-dotnet\src\Northcloud.Sync.Engine\Northcloud.Sync.Engine.csproj.
  Restore completed in 72.59 ms for C:\Users\ccharabaruk\Repos\ONAMA\dependencies\sync-framework-dotnet\test\Northcloud.Sync.Engine.Test\Northcloud.Sync.Engine.Test.csproj.
  Restore completed in 124.37 ms for C:\Users\ccharabaruk\Repos\ONAMA\dependencies\sync-framework-dotnet\test\Northcloud.Sync.Engine.Test\Northcloud.Sync.Engine.Test.csproj.
  Restore completed in 63.64 ms for C:\Users\ccharabaruk\Repos\ONAMA\dependencies\sync-framework-dotnet\src\Northcloud.Sync.Base\Northcloud.Sync.Base.csproj.
There is a mismatch between SDK NuGet version (4.9.2) and the NuGet version the task factory was compiled against (4.9.0).
[NuGet Minimal]: Restoring packages for C:\Users\ccharabaruk\.nuget\packages\gitversiontask\5.0.0-beta1-72\build\functionality\GitVersionBuild.targets...
[NuGet Minimal]: Restoring packages for C:\Users\ccharabaruk\.nuget\packages\gitversiontask\5.0.0-beta1-72\build\functionality\GitVersionBuild.targets...
[NuGet Minimal]: Installing Microsoft.NETCore.Platforms 2.0.0.
There is a mismatch between SDK NuGet version (4.9.2) and the NuGet version the task factory was compiled against (4.9.0).
There is a mismatch between SDK NuGet version (4.9.2) and the NuGet version the task factory was compiled against (4.9.0).
  Northcloud.Sync.Base -> C:\Users\ccharabaruk\Repos\ONAMA\dependencies\sync-framework-dotnet\src\Northcloud.Sync.Base\bin\Debug\netstandard2.0\Northcloud.Sync.Base.dll
C:\Users\ccharabaruk\.nuget\packages\gitversiontask\5.0.0-beta1-72\build\functionality\GitVersionBuild.targets(6,5): error MSB4175: The task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" could not be loaded from the assembly "C:\Users\ccharabaruk\.nuget\packages\utilpack.nuget.msbuild\2.9.1\build\\netcoreapp1.1\UtilPack.NuGet.MSBuild.dll". Assembly with same name is already loaded [C:\Users\ccharabaruk\Repos\ONAMA\dependencies\sync-framework-dotnet\src\Northcloud.Sync.Engine\Northcloud.Sync.Engine.csproj]

Build FAILED.

C:\Users\ccharabaruk\.nuget\packages\gitversiontask\5.0.0-beta1-72\build\functionality\GitVersionBuild.targets(6,5): error MSB4175: The task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" could not be loaded from the assembly "C:\Users\ccharabaruk\.nuget\packages\utilpack.nuget.msbuild\2.9.1\build\\netcoreapp1.1\UtilPack.NuGet.MSBuild.dll". Assembly with same name is already loaded [C:\Users\ccharabaruk\Repos\ONAMA\dependencies\sync-framework-dotnet\src\Northcloud.Sync.Engine\Northcloud.Sync.Engine.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:11.88
@arturcic
Copy link
Member

arturcic commented Mar 1, 2019

Related to #1554, Closing

@arturcic arturcic closed this as completed Mar 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants