Here is the error I was getting when running the unit test in Visual Studio 2010:
System.IO.FileNotFoundException: Could not load file or assembly 'System.ServiceModel.Web, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
I tried to get both the Project Under Test, and the Test Project to use the same System.ServiceModel library but was not successful. Visual Studio would not allow the Silverlight Project to use the same libraries as the .NET 4.0 Framework and it would also not allow the Unit Test Project to use the same libraries as the Silverlight Project. After trying different options, I found a very hacky solution.
The hacky fix is to specify the reference paths for the Unit Test project. Here is what you need to do:
- In Visual Studio 2010, right click on the Unit Test project and select Properties
- Click on Reference Paths in the menu on the left
- Add the Silverlight Reference path. For me this was:
<C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\>. To find out your specific path, look at the path of the System.ServiceModel reference being used by the Silverlight Project. - Save and rebuild the Unit Test project.
- Run the test again and this time it should run successfully.
thank you , helped me a lot. i was breaking my head with this issue :)
ReplyDeleteI had the same problem with Visual Studio 2012 and Silverlight 5.
ReplyDeleteYour solution is working very well, without any warnings.
Thank you.
Cristian
I had the similar problem.. My solution was copying dll to bin folder and reference them from bin folder.. I hope it helps..
ReplyDelete