From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Could not load file or assembly 'NationalInstruments.Common, Version=13.5.40.173 with .net 6.0

Hello,

 

I have developed a windows dll in c# with Visual Studio based on -NET 4.7.2 and it works perfectly.

When I tried to make the same library class for .net framework 6.0  I get the following exception:

 

System.IO.FileNotFoundException: 'Could not load file or assembly 'NationalInstruments.Common, Version=13.5.40.173, Culture=neutral, PublicKeyToken=dc6ad606294fc298'. The system cannot find the file specified.'

 

has anyone have faced this issue? 

Thanks for your help,


Andrea

Message 1 of 5
(2,154 Views)

Yes I had this exact same thing just happen to me, down to the version of NationaInstruments.Common. I also didn't have any issues until upgrading to .NET 6. Did you happen to find a solution?

0 Kudos
Message 2 of 5
(1,797 Views)

Are there any updates?

 

I also have the exact same exception. I assume nationalinstruments.common.dll might not be compatible with .NET, I referenced the NationalInstruments.Visa and Ivi.Visa dlls in a .NET 6 app as well as .netstandard2.0 class library and got the same exception. Interestingly I could only find nationalinstruments.common.dll with version 19.1.40.49152 and couldn't find anywhere 13.5.40.173 on my system. When referencing these two libraries in .NET Framework (4.8), everything works as expected.

 

If you can locate the nationalinstruments.common.dll with version 13.5.40.173 somewhere and explicitly reference it in your app should solve this issue.

0 Kudos
Message 3 of 5
(1,521 Views)

I guess I found a solution.

 

I was getting this exception when I call the `Open()` function on the `ResourceManager`

 

using var rmSession = new ResourceManager();
try {
  var mbSession = (MessagedBasedSession)rmSession.Open(<resourceName>);
} catch {
}

So, I located the nationalinsturments.common.dll (e.g., "C:\\Program Files (x86)\\National Instruments\\Measurement Studio\\DotNET\\v4.0\\AnyCPU\\NationalInstruments.Common 19.1.40\\NationalInstruments.Common.dll") and added this line before calling any NiVisa function

 

Assembly.LoadFrom("<nationalinstruments.common.dll file path>");

 

Message 4 of 5
(1,508 Views)

朋友你好,.net  6 的确存在这样的问题,所以你需要添加一个NationalInstruments.Common引用,然后就可以正常编译使用了。

0 Kudos
Message 5 of 5
(1,206 Views)