问题
I'm using Visual Studio 2012 Express for Web.
When I try to add a view, I get an error saying:
The templates had the following 1 error(s)
C:\Program Files\Microsoft Visual Studio
11.0\Common7\IDE\VWExpress\ItemTemplates\CSharp\Web\MV
C 3\CodeTemplates\AddView\CSHTML\Empty.tt(-1,-1): error :
There was a problem getting an AppDomain to run the
transformation from the host. The process cannot continue.
I've been plugging in Ninject (this is actually just an app to prove it's working) so it could be something to do with one of the start-up files.
Where do I start looking to try to fix this?
Thanks
Dave
回答1:
Try restarting the Visual Studio 2012 and add a view now, and that should do for you.
Have you copied the Code Templates
folder your project ?
回答2:
Restarting didn't work for me. It turns out that mvc3 had never been installed on my machine (mvc4 was in place already) and also my copy of visual studio wanted to install service pack 1. So I uninstalled the newer version of newget using the control panel restarted visual studio. The service pack (sp1) successfully installed. Now my custom .tt files successfully render new views.
Information that led me down this road:
http://forums.asp.net/t/1820254.aspx?MVC+Add+View+Model+Controller+from+template+throws+an+error
and
http://forums.asp.net/t/1729674.aspx?Installing+MVC3+after+Installing+MVC4
来源:https://stackoverflow.com/questions/14637632/exception-when-adding-a-view-to-mvc3