Problem
In my case, when testing an assembly that had a generated XmlSerializers assembly associated with it the unit tests would fail when loading the SUT assembly. The problem was caused by the serializer assembly not being copied to the deployment location of the tests.Solution
To get the serializer assembly to deploy you need to:- Mark the test class or method with a DeploymentItem attribute like so [DeploymentItem("MySubjectAssembly.XmlSerializers.dll")]
- Change your solution's LocalTestRun.testrunconfig to include, in the Deployment section, the XmlSerializers.dll from the bin\debug folder of your test project.