I've installed T4MVC via NuGet.

At the point of installation, it generated the helper classes for the project as the project was at that time. However, these generated helper classes have not been updating whenever new items have been added to the project.

Several people have had this problem and the answer always seems to be "right-click on the T4MVC.tt file and choose Run custom tool" (see here for an example). However, when I right-click on the T4MVC.tt file there's no Run custom tool option - in fact, in the file's properties there's no Custom Tool declared.

Furthermore, T4MVC.tt is a hidden file in the project, so it seems strange that I'm expected to perform this action on this file.

So can anyone explain how to have T4MVC update the generated classes in an MVC4 project?

有帮助吗?

解决方案

there are a couple of Visual studio plugins which will autorun the template when you do a build. I use AutoT4MVC

However it sounds like your solution has an issue with the template, youcould try right clicking and excluding the file from the project and then right click and add it back? (this requires you to set the option "show all files"). Alternatively you could uninstall t4mvc and then readd it. Also the setting in tools/options/text templating should allow you to see that dialog if its gone missing. Hope this helps

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top