0

I want to write a protoc-gen-... plugin to compile my .proto files into csharp files, however, i can not find any tools like google.golang.org/protobuf/compiler/protogen in golang to help me to do this, so how to write a protoc plugin to generate c# codes?

HongyanShen
  • 1,435
  • 2
  • 14
  • 23
  • Have you tried googling 'protobuf C#?' https://lmgtfy.app/?q=protobuf+c%23 – Nick Bailey Mar 11 '22 at 17:23
  • Just want to be sure, are you aware that there already such a plugin written for the proto compiler ? if yes, does that mean that you just want to try making your own? – Clément Jean Mar 12 '22 at 23:35
  • @NickBailey I just realized a protoc plugin is just a process reading CodeGeneratorRequest from stdin and printing CodeGeneratorResponse to stdout. – HongyanShen Mar 17 '22 at 15:46
  • @ClémentJean i want to make my own plugin, i checked this one https://github.com/manuelzander/python-protoc-plugin – HongyanShen Mar 17 '22 at 15:49

1 Answers1

0

If you are looking for sample plugin written in C#, I have it. Your plugin can generate any text file, not only C# code.

https://github.com/cactuaroid/protoc-gen-myplugincsharp

cactuaroid
  • 496
  • 1
  • 4
  • 19