Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013 can't open Razor views - 'The operation could not be completed'

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?

like image 603
PW Kad Avatar asked Dec 06 '13 16:12

PW Kad


2 Answers

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" />
...
like image 70
Jason Young Avatar answered Nov 04 '22 14:11

Jason Young


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

like image 24
fatih Avatar answered Nov 04 '22 13:11

fatih