ASP.Net T4MVC file not updating itself
Asked Answered
I

3

8

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!

Intromission answered 30/3, 2011 at 4:36 Comment(1)
(1) What are these missing things? can you post specific error details? (2) you maybe be confused with what T4MVC does, thats why I directed you to an earlier answer I wrote about t4mvc, it has nothing to do with models.Puckery
P
21

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

Puckery answered 30/3, 2011 at 6:44 Comment(3)
That's correct, though if you install Chirpy (chirpy.codeplex.com) it can update T4MVC automatically.Seafaring
hey! The man himself! =D =D Yep, gotta love the artwork and docs for chirpy. I've linked to a detailed answer I wrote a while back incase the OP needs instructions and such.Puckery
Still relevant as far as 2021, VS19, T4MVC 4.2.4Grotesque
R
5

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.

Responser answered 9/9, 2013 at 14:42 Comment(0)
A
3

If you want to autorun t4mvc check-out this Visual Studio pugin http://chirpy.codeplex.com/ . It has also very nice other features.

Amoakuh answered 30/3, 2011 at 8:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.