I am building a .NET application and reference two assemblies from the Measurement Studio installation: NationalInstruments.Common.dll and NationalInstruments.VisaNS.dll
My code builds and runs fine.
However, if I turn on Code Analysis in my VisualStudio project, I get an error
CA0001 Error Running Code Analysis
CA001: Could not resolve references to NationalInstruments.Common, Version=13.0.40.168
I believe I know the reason and how to fix it. Actually, National Instruments needs to fix it.
Q: What Causes This?
Hypothesis: The NI installer for the .NET language support ships version 13.0.45.167 of the VisaNS assembly and version 13.0.40.188 of the Common assembly. The VisaNS assembly was built against version 13.0.40.168 of the Common assembly, so Visual Studio code analyis is confused because it cannot find the correct assembly.
Best Fix: NI ships these two assemblies in the support tools and makes sure that the Common assembly is the version that VisaNS was built against.
I can turn off Code Analyis in my project. This is not a great solution because code analysis catches many very hard-to-find bugs.
Here is a blog that better explains the issue and gives other workarounds http://davesbox.com/archive/2008/06/14/reference-resolutions-changes-in-code-analysis-and-fxcop-part-2.aspx
But it would be nice to have the very good folks at NI issue an update (or at least test this for the next release).