Compile .proto files

Created at 25 Sep 2020, 20:33
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CT

ctid2032775

Joined 03.05.2020

Compile .proto files
25 Sep 2020, 20:33


Hi all,

maybe it's a stupid question but I didn't find any information and I am currently completely stuck...

When I want to compile the .proto files into C# classes (.cs) - which version of the protocol buffer compiler is required?

I am a little bit confused as Open API 2.0 is using protobuf2 but I didn't find a proper compiler that supports C#. Only version 3 (latest 3.13) compiles into .cs (--csharp_out) but I guess this results in classes that cannot be used with OA2, right?

Many thanks for your support and best regards,
Christian


@ctid2032775
Replies

PanagiotisCharalampous
28 Sep 2020, 08:25

Hi Christian,

You can find instructions on how to compile the .proto files here.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

ctid2032775
28 Sep 2020, 08:42

RE:

PanagiotisCharalampous said:

Hi Christian,

You can find instructions on how to compile the .proto files here.

Best Regards,

Panagiotis 

Join us on Telegram

Hi Panagiotis,

thanks for your reply - I already tried to use the linked version to compile the .proto files into C# classes...

But, this version only supports C++, Java and Python. And the Google Developer Site says that only protoc3 supports C#...

BR,
Christian


@ctid2032775

PanagiotisCharalampous
28 Sep 2020, 08:55

Hi Christian,

The procedure explains how to compile C# files. this is what I use as well and works fine.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

ctid2032775
28 Sep 2020, 19:58

RE:

PanagiotisCharalampous said:

Hi Christian,

The procedure explains how to compile C# files. this is what I use as well and works fine.

Best Regards,

Panagiotis 

Join us on Telegram

Hi Panagiotis,

when I try this I get the following error:

Translation:

The system cannot find the mentioned file.

Can you please provide me with exactly the version you are using to compile .proto into .cs!

Thanks and best regards,
Christian


@ctid2032775

afhacker
28 Sep 2020, 21:54 ( Updated at: 21 Dec 2023, 09:22 )

RE: RE:

ctid2032775 said:

PanagiotisCharalampous said:

Hi Christian,

The procedure explains how to compile C# files. this is what I use as well and works fine.

Best Regards,

Panagiotis 

Join us on Telegram

Hi Panagiotis,

when I try this I get the following error:

Translation:

The system cannot find the mentioned file.

Can you please provide me with exactly the version you are using to compile .proto into .cs!

Thanks and best regards,
Christian

You can compile the Open API proto files with the latest version of Protobuf, you can use my library which is based on latest version of Protobuf: 

 


@afhacker

PanagiotisCharalampous
29 Sep 2020, 07:50

Hi Christian,

You do not seem to follow the instructions in the documentation. Here is the generator and here is the command

ProtoGen.exe protofile.proto -output_directory=C:\output_folder --include_imports

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

ctid2032775
29 Sep 2020, 08:55

RE:

PanagiotisCharalampous said:

Hi Christian,

You do not seem to follow the instructions in the documentation. Here is the generator and here is the command

ProtoGen.exe protofile.proto -output_directory=C:\output_folder --include_imports

Best Regards,

Panagiotis 

Join us on Telegram

Hi Panagiotis,

sorry for the inconvenience, it was my mistake - I guess I used the instructions on Google Developer site for protoc v3.

Now it's working!

Many thanks and best regards,
Christian


@ctid2032775

ctid2032775
29 Sep 2020, 09:00 ( Updated at: 21 Dec 2023, 09:22 )

RE: RE: RE:

afhacker said:

ctid2032775 said:

PanagiotisCharalampous said:

Hi Christian,

The procedure explains how to compile C# files. this is what I use as well and works fine.

Best Regards,

Panagiotis 

Join us on Telegram

Hi Panagiotis,

when I try this I get the following error:

Translation:

The system cannot find the mentioned file.

Can you please provide me with exactly the version you are using to compile .proto into .cs!

Thanks and best regards,
Christian

You can compile the Open API proto files with the latest version of Protobuf, you can use my library which is based on latest version of Protobuf: 

 

Hi,

many thanks for your suggestion but it seems that your message classes do not include the latest changes for cServer 7 (e. g. "IncludeArchivedSymbols")...

Btw, as mentioned in my reply to Panagiotis it was my mistake and it's working now!

Best regards,
Christian


@ctid2032775