-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
C# protoc.exe: Support --csharp_namespace command line option #6846
Comments
i want this command line option too,so i dont need to modify the original proto files and add "option csharp_namespace = "My.Namespace"" to every single file ,it is horrible. |
I don't think this option is useful. The C++ stack should jut add the |
@jtattermusch I would see this as a feature and not an incompatibility:
Our .proto files provided by the C++ "server" team is used by multiple "client" teams (C#). The client teams are independent of each other. Every client team generates their own C# classes out of the .proto files with different settings (e.g. Namespace) and different Google.Protobuf library version. I still believe that it can be a useful option. I agree that it does not work when a single Alternative solution would be to specify a base namespace: This might be confusing as there is already the CLI option |
I just came across this issue. I thought the I also don't see
as a good reason not to do this. Teams that need this option will be making protoc multiple invocations if they need to for the different "batches" of .proto files that may need separate handlinh. This feature is even more useful in open source development where the client libraries may be written by groups who wish to namespace different based on their project names. |
Missing this option leads to the problem that if you're developing and add tests for a library that generates a grpc client using Internal access level you're generating a ton of warnings when you generate the gRPC message types also for the mocked server. |
This. Lack of that option leads to numerous issues when developing projects, which are testing the main service, and you share .proto files across various projects. As you need to create both client and server types while referencing the main service, you get tons of warnings related to namespace collision and imports must fallback to one of the types. |
What language does this apply to?
Code generator for C# (protoc.exe)
Describe the problem you are trying to solve.
Today we can define a custom C# namespace for the generated code within the proto file.
I get proto files from another team (C++ technology stack) so this option is not set. I would prefer to take the original proto files without adapting them.
Describe the solution you'd like
I would like to pass the option as command line parameter to protoc.exe:
If both variants set the
csharp_namespace
then I would prefer that the command line option wins.The text was updated successfully, but these errors were encountered: