Asp.net-mvc – Razor views: The pre-application start initialization method Start on type Microsoft.Web.WebPages.OAuth.PreApplicationStartCode threw an exception

asp.net-mvcasp.net-mvc-4razorvisual studio 2012

I'm working in an Asp.net MVC 4 project in Visual Studio 2012, when I open a view I'm getting this error:

ASP.NET runtime error: The pre-application start initialization method Start on type Microsoft.Web.WebPages.OAuth.PreApplicationStartCode threw an exception with the following error message: The type initializer for 'DotNetOpenAuth.Reporting' threw an exception.. C:\Users\escobar5\Desktop\WindowsAzure1\MvcWebRole1\Views\Shared_LoginPartial.cshtml

So I lost intellisense because after that error every call to ViewBag or model says: "One or more types required to compile a dynamic expression cannot be found"

I updated OAuth packages from Nuget but I'm still getting the error.

The project runs fine, the problem is just with razor.

This is a screenshot of the error for more detail:

Error

Any ideas?

Thanks in advance

Best Answer

I found the following explanation and updating DotNetOpenAuth.OAuth.Consumer with nuget package manager solved the problem with the error.

https://groups.google.com/forum/?fromgroups=#!topic/dotnetopenid/js58kMaWvvo