Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

CA0001 Error Running Code Analysis with NationalInstruments.Common

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...

 

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).

 

 

0 Kudos
Message 1 of 4
(7,833 Views)

Hello Chuck

 

Thanks for taking the time to look into this issue. Our customers feedback is always welcome

 

Regards

 

Mart G

0 Kudos
Message 2 of 4
(7,817 Views)

With the workaround described, the build will be successful.

But when the application runs, it will generate a run time error 

searching for "NationalInstruments.Common, Version=13.0.40.168"

 

Have you encountered the run time issue?

0 Kudos
Message 3 of 4
(4,352 Views)

SL_3

 

This is Ali from National Instrument's applications engineering. From my understanding, this error has not occurred before.

 

Thank you for taking all this time to find errors in our system and finding possible workarounds.

 

Would you mind submitting the report under here so we can formally validate it and have it sent to our R&D Department for resolution and mentioning this forum link would also be extremely helpful.

Regards,

Ali S.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 4
(4,339 Views)