8

I am opening an older WebForms project and trying to update it to ASP.NET MVC 4 in Visual Studio 2013. When I add a new project I can run it and everything works fine.

When I try to open up the Razor views (cshtml files) VS2013 gives me the generic 'The Operation could not be completed.' error message and won't open them.

If I create a new project not inside of the WebForms solution it opens the views fine.

If I right-click the file and choose 'Open with' and 'HTML (Web Forms) Editor' it opens up but without the Razor syntax highlighted.

What gives?

PW Kad
  • 14,953
  • 7
  • 49
  • 82
  • Try this answer here: [Delete content of %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache](http://stackoverflow.com/a/36056076/5694242) – kabeleced Jul 18 '16 at 11:41

3 Answers3

10

For me, I had to fix the webpages:Version setting in appSettings. For me, there was a type in the value. Make sure it's 3.0.0.0.

<appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
...
Jason Young
  • 3,683
  • 4
  • 32
  • 39
4

In my case, I had a syntax error in my web.config file, which was because of a source control update issue. When I fixed the web.config file, everything got fine

fatih
  • 183
  • 1
  • 9
  • this was the resolution to my issue with this problem. All of a sudden no cshtml files would open in my project. I have an erroneous Back Quote character in the web.config file. Once i deleted this and saved the cshtml files opened fine – Stuart Jun 06 '16 at 14:21
0

I've found that i get that error, when i've set a more specific iisurl on the mvc project.

Instead of http://domain.com:61325/ i set it to something like http://domain.com:61325/?something=fails to be able to test something more easily, but found that it makes VS2013 fail when opening the cshtml views.

Theo
  • 56
  • 2