celt237 / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
Other
0 stars 0 forks source link

Question about MSBuild automation #121

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
(Sorry about creating an issue for this if that is the correct thing to do)

In my source tree I have a .NET client and a Java server which share a .proto 
definition that is contained in a common subdirectory under the root of the 
project:

root/server/pom.xml
root/server/...
root/client/Foo.sln
root/client/...
root/protocol/*.proto

I'd like to be able to 

a) create a link in my (VS 2010) csproj to each .proto file
b) have the *.cs files generated in the directory of the csproj
c) have MSBuild drive all of this

I can link the .proto files, but I haven't found a way to convince the ProtoBuf 
custom tool to generate the output in the directory of the csproj, rather it is 
generated in the same dir as the input file.

Has anybody found a way to use the Custom Tool vis MSbuild, automate this on a 
build server and still keep use the custom tool for normal development in VS?

Thanks for any input,

Ben 

Original issue reported on code.google.com by 0x6e6...@gmail.com on 9 Jul 2010 at 9:48

GoogleCodeExporter commented 9 years ago
If you are automating (rather than using the IDE), I would be very tempted to 
simply use `protogen` at the command line - is this an option?

Original comment by marc.gravell on 10 Jul 2010 at 10:01

GoogleCodeExporter commented 9 years ago
Yes, at the moment I am just using the custom tool within the IDE am checking 
the compiled .cs files into version control.

However, I'd like not to have to do this, as it defeats the purpose of catching 
incompatible updates on the build server, e.g. when a new message is added to 
the server application.

So I was initially wondering if the VS add in could be invoked by  msbuild and 
have the build work transparently across normal VS development and continuous 
integration builds on TeamCity.

However, if invoking protogen from the command line is easier, I'm wondering if 
there is a target you can set in the csproj file that will generate the .cs for 
you in the correct place, and VS would just execute this for you whenever you 
loaded or built the project from within the IDE.

If the latter works well, it seems like the best option, but OTOH, it also 
seems like it defeats the purpose of the custom tool, because it would be as if 
the custom tool is just for projects that you are building by yourself, rather 
than as part of a development team, or am I missing the point?

 I was thinking about 

Original comment by 0x6e6...@gmail.com on 12 Jul 2010 at 5:02

GoogleCodeExporter commented 9 years ago
Simply; I'm not an MSBuild wizard. If you know how to make that work, I'm all 
ears...

Original comment by marc.gravell on 13 Jul 2010 at 12:38