Search code examples
asp.net-mvc-3t4mvc

MVC 3.0 T4MVC stopped working in VS 2010


Yesterday I was having fully compiled ASP.NET MVC 3.0 project. Today when i opened my project again it is wont compiled because of T4MVC, I was very surprised.

I readd the T4MVC template thorough NuGet again, but it is didn't help. Then i removed all related T4 VS 2010 extensions: T4 Editor, T4Utilites, and Visual T4, opened project again but it is didn't help, than i rebooted and installed T4 extensions again but it is didn't help either. Than i created new clean ASP.NET MVC 3.0 project and add T4MVC to this, and I've got the same errors (see peintscreen).

If i remove T4MVC.tt from solution than I can compile the project, but when i am put it back, I am getting errors again.

Error screen 1

Open Error screen 1

Error screen 2

Open Error screen 2

I think that the problem with Visual Studio, and now I have a very bad idea - try to reinstall Visual Studio, but may be some one may suggest something better?

p.s 1

Also I didn't install anything related to Visual Studio this days, may be only a couple of small Upstates through windows update, but they wasn't related to visual studio.

Also i have MVC 3.0 Updates tools' installed, but before today everything was working well.

It is looking very strange, i can generate *.cs files successfully using this template, there is no errors i am getting during this process, but visual studio blaming T4MVC.tt fore some reason.

p.s 2

Actually also NuGet package where updated. May be it is the case? mmm... But after removing NuGet all the same :(


Solution

  • Ok, here is the 4 steps how to fix it (no Visual Studio uninstall required :) )

    1) Remove T4MVC from project(remove T4MVC package reference)

    2) Remove NuGet using Extension manager

    3) Install NuGet back using Extension manager

    4) Add T4MVC back.

    after this magic steps i get it work.