Could not load file or assembly 'DotNetOpenAuth.Core
C#asp.net.Netasp.net Mvcasp.net Mvc-4C# Problem Overview
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, PublicKeyToken=2780ccd10d57b246' or one of its dependencies.
The system cannot find the file specified
This is the error log
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Windows\SysWOW64\inetsrv\w3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = notebook\Guilherme
LOG: DisplayName = DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
(Fully-specified)
LOG: Appbase = file:///C:/Users/Guilherme/Documents/Visual Studio 2012/Projects/Gedi/Gedi/
LOG: Initial PrivatePath = C:\Users\Guilherme\Documents\Visual Studio 2012\Projects\Gedi\Gedi\bin
Calling assembly : Microsoft.Web.WebPages.OAuth, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Guilherme\Documents\Visual Studio 2012\Projects\Gedi\Gedi\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/2635bb56/154c3fbb/DotNetOpenAuth.Core.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/2635bb56/154c3fbb/DotNetOpenAuth.Core/DotNetOpenAuth.Core.DLL.
LOG: Attempting download of new URL file:///C:/Users/Guilherme/Documents/Visual Studio 2012/Projects/Gedi/Gedi/bin/DotNetOpenAuth.Core.DLL.
LOG: Attempting download of new URL file:///C:/Users/Guilherme/Documents/Visual Studio 2012/Projects/Gedi/Gedi/bin/DotNetOpenAuth.Core/DotNetOpenAuth.Core.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/2635bb56/154c3fbb/DotNetOpenAuth.Core.EXE.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/2635bb56/154c3fbb/DotNetOpenAuth.Core/DotNetOpenAuth.Core.EXE.
LOG: Attempting download of new URL file:///C:/Users/Guilherme/Documents/Visual Studio 2012/Projects/Gedi/Gedi/bin/DotNetOpenAuth.Core.EXE.
LOG: Attempting download of new URL file:///C:/Users/Guilherme/Documents/Visual Studio 2012/Projects/Gedi/Gedi/bin/DotNetOpenAuth.Core/DotNetOpenAuth.Core.EXE.
I have already remove all references from DotNetOpenAuth with packager manager. Also I checked by my self references for every Auth assembly I had in my project and there is none.
This is my packages.config
<packages>
<package id="AutoMapper" version="2.2.0" targetFramework="net45" />
<package id="EntityFramework" version="5.0.0" targetFramework="net45" />
<package id="jQuery" version="1.7.1.1" targetFramework="net45" />
<package id="jQuery.UI.Combined" version="1.8.20.1" targetFramework="net45" />
<package id="jQuery.Validation" version="1.9.0.1" targetFramework="net45" />
<package id="knockoutjs" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="4.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi" version="4.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="4.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="4.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages.Data" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages.WebData" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.jQuery.Unobtrusive.Ajax" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="Modernizr" version="2.5.3" targetFramework="net45" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" />
<package id="Repository" version="1.0.2.12" targetFramework="net45" />
<package id="RestSharp" version="103.4" targetFramework="net45" />
<package id="WebGrease" version="1.1.0" targetFramework="net45" />
</packages>
Thanks
C# Solutions
Solution 1 - C#
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 - C#
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 - C#
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 - C#
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.
Solution 5 - C#
I solved the problem by installing the package using Nuget
Install-Package Microsoft.AspNet.WebPages.OAuth
Solution 6 - C#
Just select "Remove additional files at destination" on publish settings. This works for me
Solution 7 - C#
By installing the following two packages I resolved this problem on VS2012 Professional Update 4 RC:
-
Open the Package Manager Console from the Menu:
Tools| Library Package Manage | Package Manager Console
-
Install-Package DotNetOpenAuth.AspNet
-
Install-Package Microsoft.AspNet.WebHelpers
Hope this helps for you!!!
Solution 8 - C#
Try doing a global solution search (ctrl+shift+f if you haven't changed it) for the value '2780ccd10d57b246'. I'm guessing you'll find it in your web.config.
Solution 9 - C#
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:
- go to the bin folder of the project, clear it
- when to publish to the IIS, delete the virtual directory and assign the website again to the IIS, since I faced that issue of having cash in the server which was making the problem...
Solution 10 - C#
One more solution option is to have assembly dependency as follows:
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.AspNet"
publicKeyToken="2780ccd10d57b246"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core"
publicKeyToken="2780ccd10d57b246"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
Solution 11 - C#
I do not have the reputation to comment but I can verify that I had this exact problem and Jack gave the correct solution for me. I had recently pressed Add Service Reference and it broke the program with the above error message.
Deleting the _bin_deployableAssemblies folder, and your application's bin folder and then clean and rebuild your application made it work again.
Solution 12 - C#
In case this helps anyone - I was unable to uninstall the DotNetOpenAuth components through Nuget, so I resolved this error by deleting them from the references list directly and then re-installing dotnetopenauth through nuget.
Solution 13 - C#
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()
Solution 14 - C#
For me helped adding to csproj file the following section:
<PropertyGroup>
<PostSharpHostConfigurationFile>web.config</PostSharpHostConfigurationFile>
</PropertyGroup>
Solution 15 - C#
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.
Solution 16 - C#
Simply remove BIN folder from wwwroot, and publish again.
Solution 17 - C#
I was able to resolved it on my end by removing Microsoft.AspNet.Membership.OpenAuth
Solution 18 - C#
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>
Solution 19 - C#
Remove any Microsoft.Web.WebPages.OAuth dependencies everywhere in your projects.