I\'m trying to add the T4MVC templates to my project, but I\'m experiencing some problems. I went to Codeplex and downloaded the latest version of T4MVC, and according to th
As an addendum to this issue, if you have just installed ASP.NET MVC 3 RTM, you may hit similar problems in projects that were created using one of the MVC 3 Release Candidates.
Make sure that you have T4MVC.2.6.40 or later installed using NuGet.
Ie, reinstall T4MVC using Tools >> Library Package Manage. In the Console, type:
uninstall-package t4mvc
and then:
install-package t4mvc
to get the latest version.
You will now probably get the following error in the T4MVC.tt file:
A namespace cannot directly contain members such as fields or methods
Open the file, make it dirty (eg, by deleting the comment with the squiggly line) then close WITHOUT SAVING!!! See David Ebbo's answer, t4mvc.tt NEEDS to be dirty!
Recompile and go get a life.