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!
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With