1

Closed

MVC: Could not load file or assembly 'DotNetOpenAuth.Core,...'

description

Please remove the dependency on DotNetOpenAuth.Core from Microsoft.Web.WebPages.OAuth. Because I don't need to use DotNetOpenAuth on my project.

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.

Stack Trace:

[FileNotFoundException: 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.]
Microsoft.Web.WebPages.OAuth.PreApplicationStartCode.Start() +0

[InvalidOperationException: The pre-application start initialization method Start on type Microsoft.Web.WebPages.OAuth.PreApplicationStartCode threw an exception with the following error message: 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..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection1 methods, Func1 setHostingEnvironmentCultures) +550
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +90
System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516

[HttpException (0x80004005): The pre-application start initialization method Start on type Microsoft.Web.WebPages.OAuth.PreApplicationStartCode threw an exception with the following error message: 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..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +456
Closed Aug 20, 2012 at 7:36 PM by BradWilson
MVC doesn't have a dependency on OAuth. If you don't want it, remove references to both the WebPages OAuth DLL and the DotNetOpenAuth DLLs via NuGet.

comments

cdunlap wrote Aug 28, 2012 at 10:19 AM

I had this same problem, but realized that I need to clean the solution, delete the Bin directory for the application, and perform a full rebuild.

There were some old assemblies still hanging out in the Bin directory that were no longer referenced but were still being loaded.

Pithecanthropus wrote Mar 31 at 6:22 AM

@cdunlap, how do I do this? When I rebuild the project the bin directory gets recreated and repopulated. I believe this is happening because I once tried to build a deployable package. At the time I thought it was a sort of ad-lib option I could use or not use as I pleased, but something seems to have "stuck" in my build configuration. Is there any way I can undo it?