开发者

ASP.Net T4MVC file not updating itself

开发者 https://www.devze.com 2023-02-21 05:19 出处:网络
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,

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 want to autorun t4mvc check-out this Visual Studio pugin http://chirpy.codeplex.com/ . It has also very nice other features.

0

精彩评论

暂无评论...
验证码 换一张
取 消