简体   繁体   中英

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

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

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

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

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM