Protocol-buffers – Generate C # files from .proto files from .proto files in the pre-built event.

We have been working with protobuf for a while, and I decided to write a small console application for the client, which will allow them to perform some tests in the field.

I started a new c# console application and downloaded google.protocolbuffers and protobuf-net from nuget.

What I want to achieve is to convert my “messages.proto” file Converted to “messages.cs”

I tried to get protobuf to build the message file on the prebuild event but did not succeed. It seems that the command parameters have changed since our first implementation. I followed the example here< /p>

http://code.google.com/p/protobuf-csharp-port/wiki/ProtoGen

and added the following pre-built events

p>

"$(projectdir)packages\Google.ProtocolBuffers.2.4.1.473\tools\protogen.exe" --proto_path=./protos protos/messages.proto --include_imports -output_directory =./

But I receive the following error

Input file protos/messages.proto doesn't exist.

I Tried various combinations, but nothing seems to work. Am I approaching it all wrong or is there a problem? Any help is greatly appreciated!

Have you tried using absolute paths? I vaguely remember that I had a similar problem, and it turned out that it did not correctly resolve relative paths.

We have been working with protobuf for a while, and I decided to write a small console application for the client Program, which will allow them to perform some tests on the spot.

I launched a new c# console application and downloaded google.protocolbuffers and protobuf-net from nuget.

What I want to achieve is to convert my “messages.proto” file to “messages.cs”

I tried to get protobuf to build the message file on the prebuild event, but it didn’t work. It seems The command parameters have changed since our first implementation. I followed the example here

http://code.google.com/p/protobuf-csharp-port/ wiki/ProtoGen

and added the following pre-built events

"$(projectdir)packages\Google.ProtocolBuffers.2.4.1.473\tools\protogen. exe" --proto_path=./protos protos/messages.proto --include_imports -output_directory=./

But I get the following error

Input file protos/messages.proto doesn't exist.

I tried a variety of combinations, but nothing seems to work. Am I approaching it all wrong or is there a problem? Any help is greatly appreciated!

Have you tried using absolute paths? I vaguely remember that I had a similar problem, and it turned out that it did not correctly resolve relative paths.

Leave a Comment

Your email address will not be published.