Search code examples
asp.net-mvct4mvc

T4MVC increasing compile time drastically in ASP.Net MVC


I am using T4MVC to generate templated files for MVC and I have noticed that it is increasing my build time drastically. If I take a look at the Output window, it firsts builds the referenced projects quite fast (around 5 seconds) and then when it comes to building the MVC web application, it takes very long.. nothing is shown within the Output window until it finishes, which takes around 45 seconds.

I have just installed the T4MVC from Nuget, does it compile automatically on build? Does it take so long? Any ideas on what I can do to reduce compile time and use T4MVC as it is a great tool for maintainability?


Solution

  • That should not be happening. T4MVC does its generation at design time. i.e. each time you save the .tt file or choose 'Run Custom Tool', it regenerate sources.

    But when you build, it's essentially out of the picture, and the sources that it generated are built with the rest, and should not be adding any measurable time.

    So I suspect something else might be going on here. Questions:

    • Do you also see this when building from the cmd line using msbuild?
    • Do you see this on a clean new MVC project where you just added T4MVC?