title: How do I pull DotNetOpenAuth assembly references into unit test project for ASP.NET MVC4 solution?
body: <p><strong>Tl;dr version:</strong>  I am stuck with the exception: <em>System.IO.FileLoadException : Could not load file or assembly 'DotNetOpenAuth.AspNet, Version 4.<strong>0</strong>.0.0 ...</em></p>
  
  <p>A bit dismayed that msft used so many static classes and methods for auth in the new MVC4 project template.  Want to wrap all membership/auth functionality into a class that implements an interface so that I can mock for unit tests.</p>
  
  <p>After a couple of evenings of struggling, I have decided to start from scratch, so I removed all DotNetOpenAuth* assembly references and nuget package.config references.  I have similarly removed all references to Micrsoft.Aspnet.WebPages.OAuth.dll.</p>
  
  <p><strong>Reinstalling packages:</strong>  I run <em>install-package dotnetopenauth.aspnet</em> against three projects in solution which need the dll references.</p>
  
  <p>Solution will not build, as my wrapper has a method which wraps: Microsoft.AspNet.WebPages.OAuth(.dll).OAuthWebSecurity.RegisteredClientData and therefore I need a reference to this assy, so I run <em>install-package microsoft.aspnet.webpages.oauth</em> against the same three projects.</p>
  
  <p>Solution builds, but when I run the unit test referencing  Microsoft.AspNet.WebPages.OAuth(.dll).OAuthWebSecurity.RegisteredClientData I get a runtime exception:  <em>System.IO.FileLoadException : Could not load file or assembly 'DotNetOpenAuth.AspNet, Version 4.<strong>0</strong>.0.0 ...</em></p>
  
  <p>The references to this assembly in all three projects reference 4.<strong>1</strong>.0.0, as does the DotNetOpenAuth.AspNet assemblyIdentity in my web.config.  </p>
  
  <p>I'm using resharper to run the test, and the tests are nunit style.</p>
  
  <p>And finally here is a paste of what I see in fuslogvw.  Obviously something is looking for 4.<strong>0</strong>.0.0 but I can't figure out what or what to do about it (I have a couple of times deleted the temp data folder referenced in this dump):  </p>
  
  <p><em><strong></em>**<em>*</em>**<em></strong> Assembly Binder Log Entry  (11/13/2012 @ 10:04:54 PM) <strong></em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em></strong></p>
  
  <p>The operation failed.
  Bind result: hr = 0x80131040. No description available.</p>
  
  <p>Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
  Running under executable  C:\Program Files (x86)\JetBrains\ReSharper\v7.0\Bin\JetBrains.ReSharper.TaskRunner.CLR4.MSIL.exe
  --- A detailed error log follows. </p>
  
  <p>=== Pre-bind state information ===
  LOG: User = i7\dave
  LOG: DisplayName = DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
   (Fully-specified)
  LOG: Appbase = file:///C:/SVN/trunk/SoAndSo45/SoAndSo.Com.Tests.Unit/bin/Debug
  LOG: Initial PrivatePath = NULL
  LOG: Dynamic Base = NULL
  LOG: Cache Base = C:\Users\dave\AppData\Local\Temp\kpsvgxtp.io4
  LOG: AppName = SoAndSo.Com.Tests.Unit</p>
  
  <h1>Calling assembly : SoAndSo.Com.Tests.Unit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.</h1>
  
  <p>LOG: This bind starts in default load context.
  LOG: No application configuration file found.
  LOG: Using host configuration file: 
  LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
  LOG: Post-policy reference: DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
  LOG: GAC Lookup was unsuccessful.
  LOG: Attempting download of new URL file:///C:/SVN/trunk/SoAndSo45/SoAndSo.Com.Tests.Unit/bin/Debug/DotNetOpenAuth.AspNet.DLL.
  LOG: Assembly download was successful. Attempting setup of file: C:\SVN\trunk\SoAndSo45\SoAndSo.Com.Tests.Unit\bin\Debug\DotNetOpenAuth.AspNet.dll
  LOG: Entering download cache setup phase.
  LOG: Assembly Name is: DotNetOpenAuth.AspNet, Version=4.1.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
  WRN: Comparing the assembly name resulted in the mismatch: Minor Version
  ERR: The assembly reference did not match the assembly definition found.
  ERR: Setup failed with hr = 0x80131040.
  ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.</p>
  
  <p>Thanks!</p>