Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate .proto files during build time from a .NET contract assembly #317

Open
rodrigovaras opened this issue Nov 27, 2023 · 3 comments
Open

Comments

@rodrigovaras
Copy link

Hello,
I have a rather complex SDK framework where all of the RPC contracts were defined in C# and marked with DataContract & DataMember attributes. I have recently allowed our RPC services to allow serialize using protobuf protocol with good success.

I'm looking now for a way to produce valid and compatible proto files so we can have regular gRPC clients in other languages to interact with our services.

I understand some there is an API to allow the generation but i would prefer an msbuild task to do this job during build time like the opposite happen from .proto files to C#.
I'm missing a project that show this? Most of the discussion are related to the SchemaGenerator but mostly showing the way to write a tool or doing this on runtime.

Also i notice that most of the .NET API to generate proto is based on a [ServiceContract] attribute. Would like to know if there are other ways to trigger .proto generation for example a set of classes from a namespace regardless they participate on a service contract.
Thanks in advance,

@mgravell
Copy link
Member

Right now, there's no inbuilt mechanism to do this. We have spiked the AOT work for protobuf-net (which shares 95% of the logic with this need) but that is paused at the moment (I've recently shipped Dapper.AOT, and will need to carry over a lot of the learning points from that to this). We're probably another 6 months out from having this, as it needs to come from my free/spare time, unless someone needs it urgently enough to sponsor it.

@rodrigovaras
Copy link
Author

Thanks for the answer and looking forward if this feature become available at some point.

@blackshot
Copy link

blackshot commented Apr 6, 2024

+1 on this, this is the only thing preventing me for using protobuf-net in production, because one of the main features of grpc are contracts that can be used language agnostic. ¿How am i supposed to share contracts with my clients if they don't use C#?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants