Skip to content

MSBuild task to automatically generate c# files from .proto files

License

Notifications You must be signed in to change notification settings

hanabi1224/Protobuf.CodeGen.BuildTask

Repository files navigation

Protobuf.CodeGen.BuildTask

Build status Build Status MIT License NuGet version

MSBuild task that automatically uses official protoc binary in Google.Protobuf.Tools to generate c# files from .proto files. In order to build the generated c# files, it adds official Google.Protobuf as indirect reference to your project as well

Install via nuget

or add below code snippet to your .csproj file

Windows, Linux, OSX are all supported and tested

<ItemGroup>
    <PackageReference Include="Protobuf.CodeGen.BuildTask" Version="0.1.2" >
        <PrivateAssets>All</PrivateAssets>
    </PackageReference>
</ItemGroup>

The generated files will be under obj/_ProtobufCodeGen folder, which will be gitignored by default.

The unit test project here is a good example to demonstrate the usage of this package.

As a side note, all the .proto files are also distributed together with the output dll as embedded resources, which can be inspected by tools like ILSpy.

About

MSBuild task to automatically generate c# files from .proto files

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages