Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.Net T4MVC file not updating itself

I am wokring in ASP.Net MVC (.Net 4.0) with T4MVC template.

So far this file was getting updated with entries automatically whenever I used to add new files into my project (like controllers, views, etc.).

But for some reason, it has stopped updating itself. I have just added new folder into project with 3 aspx files and also related controllers and models. But still T4MVC does not show these things at all and the compiler gives errors for missing things.

Can anybody please help me figuring out the reason?

Thanks!

like image 350
Anil Soman Avatar asked Mar 30 '11 04:03

Anil Soman


2 Answers

T4MVC will not update itself.

You have to Right-Click the .tt files in your solution explorer and click Run Custom Tool.

When you do this, your solution will also compile.

T4MVC changes all your controller methods to virtual and writes overrides for them. So when you compile sometime, T4MVC will have a compile error, thats probably because you renamed or changed the signature of a method in your controller. Delete this method off from T4MVC and click Run Custom Tool to regenerate.

See this answer for details on T4MVC:
ASP.NET MVC3 How to reference views directly from controller

like image 165
gideon Avatar answered Oct 25 '22 09:10

gideon


That's correct, though if you install Chirpy (chirpy.codeplex.com) it can update T4MVC automatically.

AutoT4MVC is a nice little light weight option that does the auto-running of the custom tool.

It only does T4MVC though so if you use Chirpy for other stuff it may be worth keeping.

like image 44
Jamie Humphries Avatar answered Oct 25 '22 09:10

Jamie Humphries