hcoona / Grpc.Tools.MsBuild.Unofficial

This package helps MSBuild run Grpc tools generate CSharp codes from proto files & integrate them into building automatically.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Grpc.Tools.MsBuild

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 AppVeyor build status
Travis CI Travis CI build status

Getting Started

Install

Install-Package Grpc.Tools.MsBuild.Unofficial

Auto Discover

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>

Overrides

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>

Todo

  1. Run manual test for baseline DONE
  2. Run manual test for intellisense DONE
  3. Prepare test project DONE
  4. Add CI for testing on Windows & Linux DONE
  5. Bugfix & stabilize * On-going *
  6. Learn the implementation from Microsoft Bond
  7. Merge into Grpc repository

License

This project is licensed under Apache 2.0 license -- See LICENSE.txt file for details.

About

This package helps MSBuild run Grpc tools generate CSharp codes from proto files & integrate them into building automatically.

License:Apache License 2.0


Languages

Language:C# 47.5%Language:Shell 28.7%Language:PowerShell 23.9%