Tags: CLI project Configure RPC Auto-compilation for modify script TOC
Suppose the project has these files: Test.proto,testclient.cs (call GRPC client), want to click on the F5 to compile well, how to do it?
1. Download and install the NuGet package: Grpc, Grpc.tools, Grpc.Tools.MSBuild.Unofficial, google.protobuf (Note that There's a google.protocolbuffers bag, don't mix it up.
2. Modify the Grpc.Tools.MsBuild.Unofficial.props file to change the value of grpctoolsversion to the value actually used (currently the latest version is 1.15.0)
3. Modify the Grpc.Tools.MsBuild.Unofficial.targets file
1) Change the value of _grpcoutputfolder to $ (intermediateoutputpath) Of course, change to another value is OK, but if the directory does not exist need to add a build directory process, more trouble. $ (IntermediateOutputPath) location is Obj\debug, the system is the default, it is more convenient, put in this place is more appropriate
2) Change the value of Grpctoolspath to $ (msbuildthisfiledirectory). \.. \grpc.tools.$ (grpctoolsversion) \tools\, the original path is wrong, compile error.
3) Change the value of the property beforetargets after <target name= "Generategrpcfiles" to Prepareforbuild
4. Modify the project file, assuming the file name is testgrpc.csproj:
<import project= ". \packages\grpc.tools.msbuild.unofficial.1.0.51\build\grpc.tools.msbuild.unofficial.targets "Condition=" Exists (' .. \packages\grpc.tools.msbuild.unofficial.1.0.51\build\grpc.tools.msbuild.unofficial.targets ') "/> This line moves to
<import project= ". \packages\grpc.core.1.15.0\build\net45\grpc.core.targets "condition=" Exists ('.. \packages\grpc.core.1.15.0\build\net45\grpc.core.targets ') "in the back row of the/>
2) Move the <import project= "$ (MSBuildToolsPath) \microsoft.csharp.targets"/> To the last line of <Target>
Now, press F5, and you'll compile it one step at a time.
Visual Studio automatically compiles settings for GRPC projects