Last post Dec 31, 2012 04:50 AM by imran_ku07
Dec 13, 2012 04:01 PM|gokhanartuk|LINK
Hi to all.
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=22.214.171.124, 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)
The 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. And I spend like 2-3 days on it no result.
When I search on stackoverflow I saw this solution http://stackoverflow.com/questions/13374277/how-do-i-pull-dotnetopenauth-assembly-references-into-unit-test-project-for-asp/13860815#13860815 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
Any help would be appreciated. Thanx to all.
Vs2010 and 2012 failing and succeding projects
Dec 31, 2012 04:50 AM|imran_ku07|LINK
This seems be a known bug that VS Test Project does not care App.config file,
As suggested either you can use .testsettings file or use AppDomain.AssemblyResolve event to handle binding redirect.