If like me you tried to (via the GUI) to add a new gRPC service in Visual Studio 2019 and you got that error:
You are definitely not alone!
You are probably running lower version of Visual Studio 2019 < 16.4
The issue come from Visual Studio 2019 16.3.x and lower.
Here is the original explanation from Bill Hiebert (Microsoft):
If it is an asp.net core web project it should be checking for a reference to Grpc.AspNetCore of at least 2.23.2 and installing that if missing. You have 2.25 so that should be a no-op. It will also attempt to uninstall any of the following (since they are included in Grpc.AspNetCore) if it finds them at the version specified or lower, it should ignore newer versions like your reference to Grpc.Tools 2.25.0. This is what is happening on machines which are running 16.4. 16.3 did not have the check for Grpc.AspNetcore so could attempt to add the lower versioned dependency packages which would cause a downgrade failure from Nuget and the error you are seeing.
At this point you have two solutions:
- Update Visual Studio 2019 to 16.4 which is available since December 3th 2019 (the best solution)
- Or Install the following packages independently instead of Grpc.AspNetCore (worst solution):
Big thank you to Bill Hiebert who helped me to fix that issue!