Run SingleFile Generator through MSBUILD

660 Views Asked by At

i have created a Custom tool (SingleFile generator) using IVsSingleFileGenerator. Which takes "xyz.Resx" file as input and generate "xyz.Designer.resx.cs" file. This file can be generated on building/Saving the Application through IDE.

Issue is, I have given the Custom Tool Property for any .Resx file and build the application through MSBUILD. Now I am unable to build/ generate the "Designer.resx.cs" file.

How to prepare a Custom Task to run this custom tool through MSBUILD. plz help in doing the same. Thanks in advance.

2

There are 2 best solutions below

0
On

I don't think you can run CustomTool from MsBuild. Since you're the one that wrote the tool, I would definitely suggest to create msbuild task and start using it. Here are some ideas how to do that:

http://msdn.microsoft.com/en-us/library/t9883dzc.aspx http://blogs.msdn.com/b/msbuild/archive/2006/01/21/515834.aspx

Another approach would be to write executable, but that will be less efficient. Here is how you call executable from msbuild

<Target Name="your-target-name" AfterTargets="the-starting-point-of-your-target">
    <Exec Command="your_exutable-here  parameters_here" WorkingDirectory="your_working_folder" />
  </Target>

Third approach would be to write inline msbuild task http://blogs.clariusconsulting.net/kzu/writing-inline-msbuild-tasks-in-c-for-one-liners/

I hope that helps

0
On

I don't have much knowledge about this custom tool IVsSingleFileGenerator which you are using. To execute it in MSBuild you may need targets for the same given by them to generate the resx.cs file from .resx file. Or you may add a commandline call of this tool in your MSBuild script and try it.