Visual Studio 2013 Update 2 doesn't open cshtm

2019-05-07 07:55发布

问题:

I installed the new VS2013 Update 2. As soon as I open a .cshtml file VS crashes.

I tried:

  • repair VS
  • deactivated all extesions
  • devenv.exe /ResetSkipPkgs
  • resetted all settings

without success

回答1:

I had the same error after installing Xamarin. The Xamarin extension in Visual Studio couldn't be disabled so I had to completely uninstall from Control Panel.

Anyone looking for a solution that doesn't involve uninstalling, this link might help: https://bugzilla.xamarin.com/show_bug.cgi?id=26850



回答2:

For me, resolve the issue by running visual studio as a administrator.



回答3:

What worked for me:

  1. Delete the suo file
  2. Re-opened VS from the sln file

Ciao



回答4:

Most probably this would be happen after Xamarin VS extension installed.

So please follow below steps to fix. This worked for me.

Close all instances of Visual Studio.

Go into your "(Visual Studio install path)\Common7\IDE\Extensions\Xamarin\Xamarin\3.9.483.0\"

And rename the three files: System.Web.Razor.dll, System.Web.WebPages.dll, and System.Web.WebPages.Deployment.dll into System.Web.Razor.bad, System.Web.WebPages.bad, and System.Web.WebPages.Deployment.bad.

Search your registry with the registry editor and remove the "RazorTemplatePreprocessor" key.

Delete your solution user preferences files: (Solution Name).suo

When you start up Visual Studio, You can open the csHTML files.



回答5:

This happened to me too when installing Razor Generator. I had a second copy of Visual Studio open when I installed Razor Generator.

I closed out of all instances of Visual Studio and reopened, and that fixed it.



回答6:

For me this issue was caused by a config problem in Views/Web.config. The following change fixed the issue:

<system.web.webPages.razor>
- <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicFixedGuidToken=31BF3856AD364E35" />
+ <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />


回答7:

What worked for me:

  1. Disable razor generator extension.
  2. Restart VS.
  3. Open file.
  4. Re-enable razor generator extension.


回答8:

I was having this same issue (had just installed Xamarin on Visual Studio 2013, and then all .cshtml views were not opening and acting like they were not there).

Installing VS2013 update 4 fixed my issue.



回答9:

I resolved the problem by renaming the %LOCALAPPDATA%\Microsoft\VisualStudio\12.0\ ComponentModelCache folder to ComponentModelCacheOLD. First I had to quit VS2012, rename the folder, and then restart VS 2012. All problems went away.



回答10:

I know this is somewhat old, but I wanted to throw in what solved the issue for me as everything above (yes, even an uninstall and reinstall of VS failed to work).

I had to uninstall Microsoft ASP.NET and Web Tools (you can't do this through VS, you have to download the installer for the version you have and use it to uninstall it).

I then reinstalled Microsoft ASP.NET and Web Tools and made sure it was up-to-date. This resolved the issue for me.



回答11:

if you have xamarine installed , try uninstalling it , that worked for , after trying all the other options



回答12:

complete unistall and reinstall of VS solved the problem for me.