.NET, C#, TextTemplate, visual studio

Run Custom Tool on Build for Visual Studio 2015


The project that I’m working on supports multiple platform and the approach we’re doing is that we’re sharing codes across solutions. It means that some project/solution adds the source files as link from a common location. Resource (*.resx) and TextTemplate (*.tt) files are being shared across multiple projects and possibly in different platform such as .NET 2.0, .NET 4.5 and UWP.


Every time we change some part of the code in one project it might affect the output of the custom tool generated files and the custom tool (ResxFileCodeGenerator) for resource files doesn’t give exactly the same output in every platform. Now we have to run the custom tool on every file whenever we switch from one solution to another.


RunCustomtoolOnBuild is a visual studio extension that tries to run the custom tools associated to project files on build. You can download it from visual studio gallery or get the source in GitHub.

How to use:
1. Install the RunCustomToolOnBuild.vsix
2. Open Visual Studio 2015
3. Right click on the resource or text template file then click properties.
4. In the properties set the RunCustomToolOnBuild to True.
5. Build the solution. Notice that the resx or TT file regenerates the output files.



Credits to Thomas Levesque for his AutoRunCustomTool in Github.