user3807918
user3807918

Reputation: 375

AdditionalProtocArguments" parameter is not supported by the "ProtoCompile" task, .Net Core Console app

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

Answers (7)

Dave Tyler
Dave Tyler

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

everGreen
everGreen

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

SH_SWAT
SH_SWAT

Reputation: 269

I had same problem and no answers help me directly but I solve my problem by below steps:

  1. update Grpc.AspNetCore package (default Grpc project use version 2.34 and grpc.tools version 2.34 so make conflict)
  2. clean solution from VS
  3. close VS
  4. from file explorer delete all debug and bin folders on solution folder sub-directories
  5. go to nuget packages folder (by default it's on C:\Users{user}.nuget\packages)
  6. go to grpc.tools folder
  7. remove all version folders pre-2.37.0
  8. open VS
  9. build solution

Upvotes: 7

Milos
Milos

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

Johnny Wu
Johnny Wu

Reputation: 1528

Upgraded Grpc.Tools to 2.38.0 automatically solved my problem...

Upvotes: 0

Mosè Bottacini
Mosè Bottacini

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

Eirik Lohne Bakken
Eirik Lohne Bakken

Reputation: 89

I have the samme error. Downgraded AspNetCore to version 2.34 (standard on new project), and then it built correctly

Upvotes: 1

Related Questions