Could not load file or assembly 'DotNetOpenAuth.Core

Solution 1:

If you don't want use OAuth, remove references: both the WebPages OAuth DLL (I think it's Microsoft.Web.WebPages.OAuth.dll 1) and DotNetOpenAuth DLLs.


1: You can find the filename in Calling assembly. So, removing all calling assembly of DotNetOpenAuth.Core should work for you. This approach should work for other unused missing references.

Solution 2:

I had similar problem. It was really strange as the project was running OK a day before.

Removing obj and bin folders from the project folder, cleaning the solution and rebuilding it worked.

Hope that helps.

Solution 3:

I've seen this happen when deploying an MVC application as bin deploy. When you right-click on a project and select Add deployable dependencies VS will add the references to Oauth if you check the box next to ASP .NET Webpages with Razor syntax.

To fix this, delete the _bin_deployableAssemblies folder, and your application's bin folder and then clean and rebuild your application and it will work again.

Solution 4:

In my case the MVC4 application was running fine in the VS2012 debugger, but I was getting the "Could not load file or assembly 'DotNetOpenAuth.Core'" error when I publish the application on the server.

Checking the "Delete all existing files prior to publish" checkbox on the settings tab of Publish Web window solved the issue.

File System Publishing Settings

Solution 5:

I solved the problem by installing the package using Nuget

Install-Package Microsoft.AspNet.WebPages.OAuth