I keep getting this error when I'm trying to load a CRM project in Visual Studio 2013:
Could not load file or assembly 'Microsoft.Windows.Design.Host,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or
one of its dependencies. The system cannot find the file specified.
Extract the contents of CrmDeveloperToolsVS12_Installer.msi
Open a Command Prompt as Administrator
Navigate to: sdk\Tools\DeveloperToolkit\
Run: msiexec /a CrmDeveloperToolsVS12_Installer.msi /qb TARGETDIR=<EXTRACTFOLDER>
Be sure to copy the contents of the CRM MSBUILD folder you extracted from the msi package to: C:\Program Files (x86)\MSBuild\Microsoft\CRM
Then you have to edit C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe.config and add the following lines:
<dependentAssembly>
<assemblyIdentity name="Microsoft.Windows.Design.Host" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0-4.1.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
Hope this will help.
Related
I upgraded Visual Studio from VS2017 to VS2019. I opened a solution with both C# and F# in it. A C# unit test project references a F# .dll project.
The solution compiles fine but at run time, I get the following message
System.IO.FileLoadException: 'Could not load file or assembly
'FSharp.Core, Version=4.6.2.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)'
and the inner exception is
Could not load file or assembly 'FSharp.Core, Version=4.6.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
I have this in the unit tests app.config:
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.6.2.0" newVersion="4.6.2.0" />
</dependentAssembly>
and the unit test project has this in the packages.config
<package id="FSharp.Core" version="4.6.2" targetFramework="net461" />
Is there a missing reference I am not seeing?
Thanks
Bent Tranberg was right
In the test project, I changed the binding redirect to
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.6.2.0" newVersion="4.6.0.0" />
</dependentAssembly>
and it worked
I'm getting this dreaded error trying to use Ninject with Web API. The full message is:
An exception of type 'System.IO.FileLoadException' occurred in
Ninject.dll but was not handled in user code
Additional information: Could not load file or assembly
'System.Web.Http.WebHost, Version=5.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
I've tried reinstalling pretty much everything, setting copy local = true, cleaning and rebuilding, restarting VS, deleting the suo, verifying binding redirects, etc etc etc. Nothing.
The one thing I don't fully understand is why everything is referencing v 5.2.3 when the error says it's trying to load 5.0.0. Could be a clue; I don't know. Here's the redirect from web.config. Thanks for any assistance.
<dependentAssembly>
<assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
Whenever I try to create a new project of the type mentioned above I get these 4 warnings:
Pre-updating Nuget
1
Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled. xamarinProj1.Droid
2
The "ResolveLibraryProjectImports" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'xamarinProj1, Version=, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'xamarinProj1.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() xamarinProj1.Droid Build
3
Type universe cannot resolve assembly: System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. xamarinProj1.UWP Build
4
Cannot resolve Assembly or Windows Metadata file 'System.Runtime.dll' xamarinProj1.UWP c:\users\user\documents\visual studio 2015\Projects\xamarinProj1\xamarinProj1\xamarinProj1.UWP\xamarinProj1.UWP.csproj Build
Post-Nuget:
2
The "ResolveLibraryProjectImports" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'xamarinProj1, Version=, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'xamarinProj1.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() xamarinProj1.Droid Build
3
IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled. xamarinProj1.Droid 1 IntelliSense Active
5
Severity Code Description Project File Line Source Suppression State
Warning Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Text.RegularExpressions" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.IO" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Globalization" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Xml.ReaderWriter" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.ObjectModel" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Linq" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime.Extensions" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Collections" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Threading" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Diagnostics.Debug" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Reflection" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Linq.Expressions" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Threading.Tasks" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Dynamic.Runtime" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /></dependentAssembly></assemblyBinding> xamarinProj1.Droid Build
Notice that even though it's a warning in the emulator I don't see that application running (the default one "Welcome to Xamarin" label). Also, when I click on error #5 it will reappear on the next build.
Things that I've tried to solve it:
I've updated the project Nuget package and installed the newest Forms , also I've tried to install all the updates in Nuget manager for that project and still the problem remains
I've reinstalled Visual Studio and Xamarin
I've installed various version of JDK and tried to change in tools-> options-> Xamarin-> Android the various JDK folders: x64: jdk1.8.0_102 , x86: jdk1.7.0_55,jdk1.7.0_79,jdk1.7.0_80, jdk1.8.0_101
(notice that in your manual installation you suggest to install x86 and so i've tried that as well)
Installed the newest XHAM from Intel site.
Updated Android SDK and installed basically all tools (including platformer and so on) and all API 23 and API 24 content, and various extras that sounds good to have also installed the latest NDK
Change project minimum target to a much lower Android firmware version (14)
I've updated Xamarin via Visual Studio
Searched the net and even tried to reinstall Nuget package manager as one suggested
I must mention that the original installer kept freezing when I've reinstalled Xamarin (after uninstallation as I've mentioned before), and the installer kept failing so I've installed it according to the manual installation guide.
If you are developing a cross platform app in visual studio then check if your common project which is the one in which the code is shared for all other operating systems and os specific project's references that is the nuget packages do not overlap in such a way that there is ambiguity.
I faced the same problem and removing the common references solved my problem in no time.
The package that was common in my case was named 'Windows'.
you can check your solution explorer like this.
You may want to try:
Cleaning all projects in your solution
Manually deleting all bin & obj directories in your solution
Updating all NuGet packages (solution-wide) to the "latest stable" versions
Running Update-Package –reinstall in the Package Manager Console (and verifying that there are no warnings present on any references)
Additionally, I have encountered errors with Xamarin.Forms that required me to uninstall the Xamarin.Forms NuGet package from the Android project and then reinstalling the "latest stable" version of Xamarin.Forms (not the Xamarin.Android.Support.* packages- those will automatically install during the reinstallation of Xamarin.Forms).
Doing the above usually resolves these strange errors for me. I hope this helps-
good luck!
You can check/confirm if the ability to Restore/ Check missing Nuget package is already enabled in Visual Studio?
Open Visual Studio -> Tools -> Options -> NuGet package manager -> General. Make sure that both the checkboxes for "Allow Nuget to download missing packages" and "Automatically check for missing packages during build in Visual Studio" are checked. Once they are, try to Clean then Build the Solution.
Or
you can installed Mirosoft.NETCore.UniversalWindowsPlatform package via the Package Manager Console:
PM> Install-Package Microsoft.NETCore.UniversalWindowsPlatform
After that everything will work correctly.
The references
reference1
reference2
I had the same issue and found that path to the my VS Solution directory was too long. I moved my solution to the root of D drive and it all went good.
This is what I get when I open it, anyone had this issue before? Never happened to me:
Could not find file 'C:\Windows\SysWOW64\WindowsPowerShell\v1.0\typesv3.ps1xml'.
Could not find file 'C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Event.Format.ps1xml'.
Could not find file 'C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Event.Format.ps1xml'.
update: after adding those entries to devenv.config now I get:
There were errors in loading the format data file: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\EXTENSIONS\AUEN3JAD.VIJ\Modules\NuGet\NuGet.Format.ps1xml, Error in file C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\EXTENSIONS\AUEN3JAD.VIJ\Modules\NuGet\NuGet.Format.ps1xml: '', hexadecimal value 0x13, is an invalid character. Line 311, position 36.
There were errors in loading the format data file: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\EXTENSIONS\AUEN3JAD.VIJ\Modules\NuGet\NuGet.Format.ps1xml, Error in file C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\EXTENSIONS\AUEN3JAD.VIJ\Modules\NuGet\NuGet.Format.ps1xml: '', hexadecimal value 0x13, is an invalid character. Line 311, position 36.
Try adding these lines to devenv.exe.config file in the runtime section. It may work.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Management.Automation" publicKeyToken="31bf3856ad364e35" />
<publisherPolicy apply="no" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.PowerShell.Commands.Utility" publicKeyToken="31bf3856ad364e35" />
<publisherPolicy apply="no" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.PowerShell.ConsoleHost" publicKeyToken="31bf3856ad364e35" />
<publisherPolicy apply="no" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.PowerShell.Commands.Management" publicKeyToken="31bf3856ad364e35" />
<publisherPolicy apply="no" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.PowerShell.Security" publicKeyToken="31bf3856ad364e35" />
<publisherPolicy apply="no" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.PowerShell.Commands.Diagnostics" publicKeyToken="31bf3856ad364e35" />
<publisherPolicy apply="no" />
</dependentAssembly>
</assemblyBinding>
</runtime>
To do this, click Start, type Command Prompt or cmd in the Search box, right-click Command Prompt, and then click Run as administrator. If you are prompted for an administrator password or for a confirmation, type the password, or click Allow.
Type Command
C:\windows\system32>sfc /scannow
Adding the lines indicated above worked for VS2013, but then I had the same issue for VS2015, and it didn't work there. What worked there was Ed Vowles' comment here: https://github.com/NuGet/Home/issues/2836:
"I was able to resolve this problem by installing (or reinstalling) PowerShell from here https://www.microsoft.com/en-us/download/details.aspx?id=50395 (choosing this version: Win7AndW2K8R2-KB3134760-x64.msu for my windows 7 machine) and restarting."
I am facing with very strange error in my project. I installed DotnetOpenAuth.Aspnet and Microsoft.AspNet.WebPages.OAuth libraries nuget packages. When I run the project there is no problem. But When I write the test for controllers it is throwing an exception like the following.
Test method MvcApplication2.Tests.ControllerTest.should_return_not_empty_content threw exception:
System.IO.FileLoadException: Could not load file or assembly 'DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246'
or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Another strange point is If I setup a project in VS 2010 as MVC3 application and tests are passing. No failure. But When I do the exactly same setup in VS2012 it is firing the same error as above.
When I search on stackoverflow I saw this solution but it didnt work either.
You can find all projects and sample tests in the following lines. It is just one app one test project. Very easy to read.
Also I added a sample code in here for controller and failing test.
The pastebin link for code preview is http://pastebin.com/1PCpq3hW
Any help would be appreciated.
Vs2010 and 2012 failing and succeeding projects
A detailed log result like the following
*** Assembly Binder Log Entry (13.12.2012 # 22:27:31) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files (x86)\JetBrains\ReSharper\v7.0\Bin\JetBrains.ReSharper.TaskRunner.CLR4.exe
--- A detailed error log follows.
=== bind state information ===
LOG: User = DEVELOPER-PC\DEVELOPER
LOG: DisplayName = DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
(Fully-specified)
LOG: Appbase = file:///D:/Development/Coachius/CoachiusWeb.Tests/bin/Debug
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : CoachiusWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Development\Coachius\CoachiusWeb.Tests\bin\Debug\CoachiusWeb.Tests.dll.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\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:///D:/Development/Coachius/CoachiusWeb.Tests/bin/Debug/DotNetOpenAuth.AspNet.DLL.
LOG: Assembly download was successful. Attempting setup of file: D:\Development\Coachius\CoachiusWeb.Tests\bin\Debug\DotNetOpenAuth.AspNet.dll
LOG: Entering run-from-source 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: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
I have solved it with
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<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>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
I think I may have found a possible solution.
See this link
The key pieces of information here are at lines 3 and 7. Basically, Microsoft.Web.WebPages.OAuth needs DotNetOpenAuth.Core 4.0.0.0, but the DotNetOpenAuth.Core I have is version 4.3.0.0.
This is due to a very nasty bug in VS 2012. In VS 2012 in the test projects, assembly redirection in app.config file doesn't work.
This explains why it works in VS 2010 and not in VS 2012.
It is quite annoying.
A work around is to add a .testsettings file and associate it from the test menu to the project. You have to go to a solution folder for that, if not you will not see it in the menu.
Beware, a lot of resource on the internet says runsettings with forcing older version to work will do the trick, it will not. It will crash your VS / test process. You need a testsettings file.
What you are doing by that is to use VS2010 runner, which doesn't have this bug. On the other hand it is slower.
I hope Microsoft fixes this soon, the problem is not only with OpenAuth but literally with every DLL using a different version from another DLL.
Welcome to DLL Hell version year 2012.
Look for bindingRedirects in your web.config file and make sure they also exist in your unit test's app.config file.
Did you add the assemblies to your test project?
They should show up in the folder when you compile. Since your test project is the host, it needs the same assemblies for test (depending on the setup but as a general rule)
If so, then you can look a step further in the actual binding details.
See my posting here on enabling fusion logging.
How to enable assembly bind failure logging (Fusion) in .NET
Enable it, check the folder and look for bind failures - you'll see what assembly is trying to load it (usually). If you don't - enable successes and failures and in turn look at all the assembly versions. Sometimes you'll see multiple versions loaded which helps track down the issue, or an unexpected version.
I changed the versions to 4.1.0.0 and it worked for me
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780CCD10D57B246" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780CCD10D57B246" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>