The T4MVC template throws an exception "T4MVC can only execute through the Visual Studio host" if it is transformed outside of Visual Studio. This makes automation of the project build very difficult when using msbuild and tools such as CruiseControl.NET.
It is now possible to transform T4 templates as part of the build process using the T4 MSbuild integration that comes with the Visual Studio 2010 Visualization and Modeling SDK. See Oleg's post on this at
. These extensions modify the build process of a project to perform T4 transformation before compiling the source and you no longer need to edit/save the tt file to get changes updated.
However, the T4MVC template fails when run in this manner as it thinks it is not in the Visual Studio Host.
Our organisation, and probably many others, need to be able to transform T4 templates during the build process and in particular during our automated build processes. Currently the T4MVC template makes this impossible. We have to commit the generated files
to source control and manage the many commit conflicts that occur as a result.
The T4MVC template should support execution outside the Visual Studio Host environment. We can't live without T4MVC or our automated builds, but they currently can't live together!