Skip to content

Latest commit

 

History

History
18 lines (11 loc) · 1.03 KB

README.md

File metadata and controls

18 lines (11 loc) · 1.03 KB

Protobuf

  • Navigate to the protobuf from GitHub releases page and download the protoc-<VERSION>-win64.zip for Windows, this includes a pre-built binary of the protoc tool, compiler etc.

  • Extract it, place it in some folder like C:\ and add the directory C:\protoc-<VERSION>-win64\bin to the path variable.

  • Verify whether added properly to path variable or not by typing in command prompt - protoc -help

  • Follow Google tutorial for Protobuf using C#.

  • Compile the .proto file to C# class

    protoc -I. --csharp_out=. ./addressbook.proto "This generates Addressbook.cs in the solution folder".

  • To compile this code, we need to reference the Google.Protobuf assembly.

    PM > Install-Package Google.Protobuf

  • Add using directives to Program.cs for generated class form compiler (if namespace if different), and Google.Protobuf.