Exception when adding a View to MVC3
Asked Answered
W

2

4

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

Weichsel answered 1/2, 2013 at 0:19 Comment(2)
Try restarting the Visual Studio 2012, and add a View to your projectBerners
@Karthik, did the trick. If you want to add it as an answer I'll mark it as such. Any idea why it happened?Weichsel
B
4

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 ?

Berners answered 3/2, 2013 at 4:9 Comment(3)
Nope, just been mucking about with Castle Windsor and Ninject so playing with the start-up stuff.Weichsel
I dont have an idea of what was wrong with that but i've seen that issue on [connect.microsoft.com]( connect.microsoft.com/VisualStudio/feedback/details/736308/…) you can see the post from microsoft, as they were also trying to fix itBerners
This solution oddly worked for me, even though I hadn't added any new .tt templates to my Project since opening it. Closing Visual Studio caused the Solution to be saved, which may have been the root of the issue. I did have .tt files in the Project from a previous session, but that was true both when it didn't work, and when it did after closing Visual Studio and reopening it.Villon
L
1

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

Larine answered 2/12, 2014 at 21:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.