1

I love that protobuf-net has a custom tool installed along with its installer.

However, my team uses an in-solution folder lib directory, under which you can find protobuf-net.

How can I register the custom tool target for this solution/my projects only, without doing any global changes to my VS2010 settings? I'm happy to hack my csproj/sln files as needed.

Thanks!

David Pfeffer
  • 38,869
  • 30
  • 127
  • 202

1 Answers1

2

You can't. Custom tools in VS (i.e. via the item properties) are insanely hard coded. I would love it if this was easier to deploy, I really would - then I could deploy it with nuget. However, currently the only way to install a custom tool is with registry hacking, which requires an installer.

I even pestered Phil Haack about it when we were both in Sweden, but: that option doesn't exist. I even looked into the other extension options new in VS2010 (via the extension manager), but I'm pretty sure these also don't include custom-tool support.

However! If all you want is to be able to generate the files, then all you actually need to do is to execute protogen, specifying the .proto files to use as input. So if you are happy to change your csproj such that the build launches the protogen exe, that will probably suffice.

Note that the protogen tool only does code-generation, and any code generated with the v1 version of protogen should still work fine if you are referencing the v2 library dll.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • Another component we use in our project, LinqToXSD, does something similar -- see their readme's `Visual Studio integration` section: http://linqtoxsd.codeplex.com/SourceControl/changeset/view/56601#989005 – David Pfeffer Dec 13 '11 at 12:57
  • Is there a way to do something similar, in order to call protogen without specifically setting that in the project? – David Pfeffer Dec 13 '11 at 12:58
  • @David no, not that I am aware of. It must either be pre-installed in the IDE, or done independently. Unless you want to volunteer to write the custom build tasks? – Marc Gravell Dec 13 '11 at 13:01
  • I've never done it before, but I'd be willing to give it a shot. Do you know if the next VS release fixes the above issue before I spend time working on a problem that will be largely irrelevant if it does? – David Pfeffer Dec 13 '11 at 13:06
  • @David I have not investigated the extension changes in VS vNext; I do not know if this situation changes. As an aside; note that protogen is merely an exe wrapper - the codegen itself is available in library form. – Marc Gravell Dec 13 '11 at 13:07
  • Thanks Marc. In my case, project A creates a tool that is used by other projects in the solution. It seems that pre-build events on other projects are a more likely solution than dyno-magically installing a custom tool. – Roy Tinker Oct 18 '12 at 23:51