When I try to open .cshtml files in Visual Studio 2013 I get this error:
Object reference not set to an instance of an object
I have tried the solution given here but it did not work.
Here is my appsettings section in the web.config
:
<appSettings>
<add key="Port" value="25" />
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
i do not think that the problem is about this particular project, because all my other MVC projects have same problem.
I had exact same issue in Visual Studio 2015.
I solved it by deleting all files in %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache
(the 14.0
folder with be different depending on VS version installed I think.
Try creating a new project and add a cshtml file. Do not make any other changes and do not use any templates you created. If the issue still occurs when you attempt to open this file, something is wrong with your system.
In this case you could attempt to get more information from VS by enabling the log. Detailed link to enable log
Simple example
Devenv /log
Here's a relatively weird process that has worked for me before:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With