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
OK, I figured it out. The problem was that apparently since the last release of the T4MVC package, Microsoft changed the location of the ITextTemplateHost
interface, so I needed to import another namespace. Also, the .dll
files with these namespaces aren't imported in the default ASP.NET MVC template project. This is what I did to make it work:
Add references to the following .dll files (search paths on my machine in brackets):
Microsoft.VisualStudio.TextTemplating.10.0.dll (C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.TextTemplating.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.10.0.dll)
Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll (C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.TextTemplating.Interfaces.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll)
Make sure the following namespaces are both imported in T4MVC.tt
(just follow the syntax that's already in the file).
Microsoft.VisualStudio.TextTemplating
Microsoft.VisualStudio.TextTemplating.Interfaces
Delete all generated code files (they'll appear if you expand the T4MVC.tt
in Solution Explorer).
Build project. If no files are generated, open T4MVC.tt
, edit something, don't save and build. That should do it!