Search code examples
.net.net-3.5.net-4.0fxcopassembly-resolution

How to add .NET 3.5 and .NET 4.0 assemblies to FxCop code analysis?


I want to analyze a solution that contains projects targeting .NET 3.5 SP1 and some other projects targeting .NET 4 with some dependencies to .NET 3.5 libraries.

When I try to add both assemblies, one for .NET 3.5 and another for .NET 4, FxCop throws an exception:

AssemblyLoadException
Conflicting target platforms
'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' vs
'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Is there any way to tell FxCop to only use version 4.0.0.0?


Solution

  • Is there any way to tell FxCop to only use version 4.0.0.0?

    No, I don't think there is - you will need one FxCop project for the projects targeting .NET 3.5, and another for those targeting .NET 4.0.