This package helps MSBuild run Grpc tools generate CSharp codes from proto files & integrate them into building automatically.
** This project is deprecated because Grpc.Tools official support it. **
Build System | Status |
---|---|
AppVeyor | |
Travis CI |
Install-Package Grpc.Tools.MsBuild.Unofficial
The package would automatically discover *.proto files under your project directory.
If you need add more files out of your project directory, you are able to include them by add such section in your poject file:
<ItemGroup>
<ProtoFile Include="..\protos\helloworld.proto" />
</ItemGroup>
You might also need to add more folders for Grpc includes:
<PropertyGroup>
<GrpcIncludeFolders>..\protos\;.</GrpcIncludeFolders>
</PropertyGroup>
Here is a list of the configuration properties and their default values. You can override them by setting them in your csproj file or, if you prefer to leave the project file untouched, in a Directory.Build.props file that can be added to the project folder.
- GrpcToolsVersion: 1.6.1
- GrpcToolsPath:
$(UserProfile).nuget\packages\grpc.tools$ (GrpcToolsVersion)\tools\ - GrpcCSharpPluginExecName: grpc_csharp_plugin
- GrpcProtocExecName: protoc
- GrpcIncludeFolders: .
- AutoDiscoverProjectProtocFiles: true
- GrpcCSharpPluginExec: null
- GrpcProtocExec: null
- GrpcAdditionalArguments: null
Additionally, you can specify multiple folders where the generated output should be copied to by setting the GrpcOutputFolderCopy property. This is useful for example when you have the proto files in the server project and the gRPC output needs to be copied to the client project after the generation.
Example csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<GrpcToolsVersion>1.10.0</GrpcToolsVersion>
</PropertyGroup>
<ItemGroup>
<GrpcOutputFolderCopy Include="../folder1" />
<GrpcOutputFolderCopy Include="../folder2" />
<GrpcOutputFolderCopy Include="../folder3" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.5.1" />
<PackageReference Include="Grpc" Version="1.10.0" />
<PackageReference Include="Grpc.Tools" Version="1.10.0" />
<PackageReference Include="Grpc.Tools.MsBuild.Unofficial" Version="1.0.44" />
</ItemGroup>
</Project>
Example Directory.Build.props:
<?xml version="1.0" encoding="utf-8" ?>
<Project>
<PropertyGroup>
<GrpcToolsVersion>1.10.0</GrpcToolsVersion>
</PropertyGroup>
<ItemGroup>
<GrpcOutputFolderCopy Include="../folder1" />
<GrpcOutputFolderCopy Include="../folder2" />
<GrpcOutputFolderCopy Include="../folder3" />
</ItemGroup>
</Project>
- Run manual test for baseline DONE
- Run manual test for intellisense DONE
- Prepare test project DONE
- Add CI for testing on Windows & Linux DONE
- Bugfix & stabilize * On-going *
- Learn the implementation from Microsoft Bond
- Merge into Grpc repository
This project is licensed under Apache 2.0 license -- See LICENSE.txt file for details.