I get the following error when I start my asp net mvc 4 application:
Could not load file or assembly \'DotNetOpenAuth.Core, Version=4.0.0.0,
Culture=neutral
I was getting this error as well, but with an ASP.NET MVC 5 project. I solved it by installing the Package DotNetOpenAuth.Mvc5 and calling AsActionResultMvc5() instead of AsActionResult()
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.
I run into this issue when working on updating all of ours libraries. this link helped me fix this issue. https://www.devexpress.com/Support/Center/Question/Details/Q554890/the-could-not-load-file-or-assembly-dotnetopenauth-core-version-4-0-0-0-error-message-is .
Specially I added these binding redirects to my web.config file.
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780CCD10D57B246" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-4.1.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780CCD10D57B246" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-4.1.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
I had the same problem here. My published web.config didn't have the lines:
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
<bindingRedirect oldVersion="1.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
Just added and it worked.
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.
for me, it worked like the following, using packager manager console, I've uninstall the packages, by the following order sequence and I re installed it, it solved my issue..
Uninstalling
Uninstall-Package Microsoft.AspNet.WebPages.OAuth
Uninstall-Package DotNetOpenAuth.AspNet
Uninstall-Package DotNetOpenAuth.OpenId.RelyingParty
Uninstall-Package DotNetOpenAuth.OpenId.Core
Uninstall-Package DotNetOpenAuth.OAuth.Consumer
Uninstall-Package DotNetOpenAuth.OAuth.Core
Uninstall-Package DotNetOpenAuth.core
Build, If you are not using the above packages then this should solve the problem, to Install the above again in case you need it, do the following..
Reinstall
install-Package DotNetOpenAuth.AspNet
install-Package Microsoft.AspNet.WebPages.OAuth
install-Package DotNetOpenAuth.OpenId.RelyingParty
install-Package DotNetOpenAuth.OpenId.Core
install-Package DotNetOpenAuth.OAuth.Consumer
install-Package DotNetOpenAuth.OAuth.Core
install-Package DotNetOpenAuth.core
recommanded: