Reputation: 375
I am not sure what has happened but I had grpc working between a Console App and a ASP.NET Core grpc server but then the Console app stopped compiling when I made changes to the proto file. I then decided to create a completely new console app following the examples and while my proto file (from the examples) was set to Server then the grpc service builds ok, but once I changed it to Client in the Console app I get this error.
The "AdditionalProtocArguments" parameter is not supported by the "ProtoCompile" task. Verify the parameter exists on the task, and it is a settable public instance property.
I do not get this issue with a grpc service, just clients - and even new client applications. So I can eliminate my specific coding. This is a build/configuration issue. Another issue is that when adding a new file, looking to add Proto files returns no options but when I do this on the server project, I get the option of a Protocol Buffer file.
My packages on the clients are Google.Protobuf 3.15.8; Grpc.Net.Client 2.37.0; Grpc.Tools 2.37.0
I don't know what to do. I can create a completely new Console app, add the nuget packages, add a Protos folder and when I try to add a proto file, I don't even get offered that type of file. I've even rebooted with no effect!
Example of grpc client and server that I followed
Upvotes: 10
Views: 6001
Reputation: 595
I had put the client and the service in the same Visual Studio 2019 solution (to keep all the related projects together).
This resulted in the above error. Unloading either the client or the service project fixed the error.
Upvotes: 0
Reputation: 131
One can instead use the Grpc.AspNetCore metapackage. It points to matching versions of google protobuf, grpc aspnet core server client factory and grpc tools and you don't need to track specific versions to install. This fixed the issue for me.
Upvotes: 0
Reputation: 269
I had same problem and no answers help me directly but I solve my problem by below steps:
Upvotes: 7
Reputation: 1465
Cleaning the project and restarting Visual Studio fixed the error for me like recommended here
Update: After updating gRPC related nugets to latest versions (not the ones added by Visual Studio default template) this is not happening anymore. At this moment working versions are: 2.38.1 for Grpc.Tools, 3.17.3 for Google.Protobuf, 2.38.0 for Grpc.Net.Client
Upvotes: 18
Reputation: 1528
Upgraded Grpc.Tools to 2.38.0 automatically solved my problem...
Upvotes: 0
Reputation: 4216
looks like that deleting
AdditionalProtocArguments="%(_Protobuf_OutOfDateProto.AdditionalProtocArguments)"
form C:\Users\your user\.nuget\packages\grpc.tools\2.37.0\build_protobuf\Google.Protobuf.Tools.targets
(circa row 291) fix the compilation, unfortunately I cannot say what side effect this can cause... but it appears to work in my dummy project
Upvotes: 2
Reputation: 89
I have the samme error. Downgraded AspNetCore to version 2.34 (standard on new project), and then it built correctly
Upvotes: 1