Lack of 'DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' in MVC 4 project

Yoda picture Yoda · Jun 29, 2014 · Viewed 10.6k times · Source

I have downloaded project which is the effect of Pluralsight MVC 4 free tutorial videos available at Microsoft's site: http://www.asp.net/mvc/videos/pluralsight-building-applications-with-aspnet-mvc-4

Link to project: http://www.speedyshare.com/GGTrM/odetofoodmvc4-7c20f071ef3b.zip

I've already create MVC Music Store app and it works fine. Altough this project, which obviously suppose to be correct, after running from Visual Studio 2013 I gives this message:

System.IO.FileNotFoundException: Cannot load file 'DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' 

Stack:

[FileNotFoundException: Nie można załadować pliku lub zestawu 'DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' lub jednej z jego zależności. Nie można odnaleźć określonego pliku.]
   Microsoft.Web.WebPages.OAuth.PreApplicationStartCode.Start() +0

[InvalidOperationException: Metoda Start w typie Microsoft.Web.WebPages.OAuth.PreApplicationStartCode, wywoływana na etapie inicjalizacji przed uruchomieniem aplikacji, zgłosiła wyjątek; komunikat o błędzie: Nie można załadować pliku lub zestawu 'DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' lub jednej z jego zależności. Nie można odnaleźć określonego pliku..]
   System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +556
   System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +102
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +153
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516

[HttpException (0x80004005): Metoda Start w typie Microsoft.Web.WebPages.OAuth.PreApplicationStartCode, wywoływana na etapie inicjalizacji przed uruchomieniem aplikacji, zgłosiła wyjątek; komunikat o błędzie: Nie można załadować pliku lub zestawu 'DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' lub jednej z jego zależności. Nie można odnaleźć określonego pliku..]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9885060
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

Question: Does my system lack any tools to run this application? If yes, how to install DotNetOpeanAuthCore in this version.

Answer

Adam Tuliper - MSFT picture Adam Tuliper - MSFT · Jun 29, 2014

In this specific case, simply go to Tools - NuGet Package Manager - Manage Packages for Solution and look AT THE TOP of the windows and there will be a button "Some NuGet packages are missing from this solution. Click to restore from your online package source" It's literally at the very top of the dialog. Click the Restore button and you are back in business. Rebuild your solution and the items that listed in error under /References should now be showing up ok.

If this happens in other scenarios, check your packages.config file to see what version is listed. If it is listed there restore the same version either via the gui or you can use the cmd line (I always use cmd line for nuget)

You can always just go to Tools -> NuGet Package Manager -> Package Manager Console And in the console window type

Install-Package DotNetOpenAuth.Core -Version 4.3.4.13329

(Replace with whatever version you need - thats the latest as of this writing but your project may use an earlier one) Again, thats for other scenarios - just extra info here. For this project you can just restore the packages like I mentioned in the beginning.