Skip to content
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

error MSB4062: The "Grpc.Tools.ProtoToolsPlatform" task could not be loaded from the assembly #20501

Closed
khteh opened this issue Oct 7, 2019 · 8 comments

Comments

@khteh
Copy link

khteh commented Oct 7, 2019

grpc/grpc-dotnet#561

What version of gRPC and what language are you using?

GRPC 2.23.0, ASP.Net Core 3.0 C#.

What operating system (Linux, Windows,...) and version?

Ubuntu 19.04

What runtime / compiler are you using (e.g. python version or version of gcc)

What did you do?

dotnet run --project src/myproject
If possible, provide a recipe for reproducing the error. Try being specific and include code snippets if helpful.

What did you expect to see?

What did you see instead?

/home/khteh/.nuget/packages/grpc.tools/2.23.0/build/_protobuf/Google.Protobuf.Tools.targets(64,5): error MSB4062: The "Grpc.Tools.ProtoToolsPlatform" task could not be loaded from the assembly /home/khteh/.nuget/packages/grpc.tools/2.23.0/build/_protobuf/netstandard1.3/Protobuf.MSBuild.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. [/usr/src/AspNetCoreApiStarter/src/Web.Api.Core/Web.Api.Core.csproj]

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

See TROUBLESHOOTING.md for how to diagnose problems better.

Anything else we should know about your project / environment?

@khteh
Copy link
Author

khteh commented Oct 10, 2019

Found out that this happens when there are orphaned dotnet processes running in the background. killall dotnet and it disappears!

@thefringeninja
Copy link

I noticed this happened to me when I had my ide open and I upgrading my version of the tools.

@jtattermusch
Copy link
Contributor

Can this be closed then?

@khteh
Copy link
Author

khteh commented Oct 22, 2019

What's the reason to close it?

@jtattermusch
Copy link
Contributor

According to #20501 (comment) it doesn't look like it's a grpc issue.

@khteh
Copy link
Author

khteh commented Oct 22, 2019

Then where does "error MSB4062" belong to? Who is supposed to fix the "error"?

@thefringeninja
Copy link

dotnet/cli#9458

This is a consequence of these optimizations. I don't think there is much you can do other than kill any dotnet processes that are hanging around. The canonical way to do this is dotnet build-server shutdown.

@khteh khteh closed this as completed Oct 23, 2019
@enif-lee
Copy link

enif-lee commented Nov 26, 2019

For someone reach in here, I leave this comment(origin : https://youtrack.jetbrains.com/issue/RIDER-25412)

Why this problem is made.

  1. .NET Core have 3 persistent process to optimize there build time.

  2. MsBuild does not allow tasks with same assembly name but different version yet.

  3. You have different versions of grpc references by multiple project.

So, MsBuild One Persistent host try to load Protobuf.MSBuild.dll. from the different versions assembly, But this is not allow currently. Because, Each MsBuild Task does not have own AssemblyLoadContext(In my think, msbuild might share single context to build for all projects in solution).

How to resolve it.

All Grpc related references should be have same version (particular Grpc.AspNetCore and Grpc.Tools) in solution.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants