Custom tool error: Command.proto:11:18: "Message2" is not defined.

Posted by cornerback84 on Stack Overflow See other posts from Stack Overflow or by cornerback84
Published on 2010-04-10T08:02:15Z Indexed on 2010/04/10 8:13 UTC
Read the original article Hit count: 326

Filed under:

I am using the latest version of protobuf-net with VS2008 integration. I have created 2 messages (Message1 and Message2), 1 message in 1 proto file. When I try to reference Message2 in Message1 the code generator tool gives me error "Message2" is not defined and won't generate the code file. The package for both messages is same.
It look like that because of the integration of the tool with VS2008 it expects all the messages in same .proto file to compile. Currently I have to paste an empty message with same name in Message1.proto file, like this:

message Message1 {
 optional Message2 message2 = 1;
}

message Message2 {
}

And then later on remove the declaration of class Message2 from Message1.cs. Are there any settings that I need to do so to avoid this error, or is providing an empty declaration the only way?

© Stack Overflow or respective owner

Related posts about protobuf-net