How to get Code Coverage working on a VS 2010 project?
When I turn on Code Coverage in my test settings, on a project that refer开发者_如何学编程ences the Unity DI container I get the following error:
Cannot initialize the ASP.NET project '{Project Name}'.
The event log specifies the following reason:
Could not load file or assembly 'Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name signature could not be verified.
How do I get around this issue?
I am running Visual Studio 2010 Ultimate on a Windows 7 X64 machine.
How do I get around this issue?
A shot in the dark without knowing the root cause: Have you tried using the strong name utility to skip verification of the offending assembly(s)?
sn -Vr <assembly>
I've had the exact same problem (although with Ninject) - see the second error in my question.
The proposed solution (which I haven't had time to verify yet) is to re-build the non-working assembly with signing turned off.
This assumes, of course, that you have the source code available. I had to build Ninject against .NET 4 myself (there was no released version for .NET 4 when I started the project), which is why I ended up in this situation in the first place.
精彩评论