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 8
(5,488 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 8
(5,131 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 8
(4,855 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 8
(4,842 Views)

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

0 Kudos
Message 5 of 8
(4,540 Views)

Hello, I've had exactly the same problem and found another way to solve it. Maybe it'll help somebody.

I just did a clean and re-imported my assemblies all from the same directory. Something must have gone wrong in the links since I added the assemblys one after another and from differents locations (Program Files x86 and Documents)

0 Kudos
Message 6 of 8
(2,030 Views)

There is no solution as NI Measurement Studio only supports .NET Framework which essentially has been discontinued in favor of .NET (formerly known as .NET Core). The .NET Framework 4.8.x (VS2019) apparently the last support NI is willing/able to provide.

 

There are some libraries that works in .NET 5+, but NationalInstruments.Common is not one of them, and by extension neither does NationalInstruments.UI (which we rely on).

0 Kudos
Message 7 of 8
(1,592 Views)

I had the same issue. But it turned out I had a NationalInstruments.Common.dll version 12.xxx.xx referenced. After I referenced the higher version 19.1.40.49152 it did work.

0 Kudos
Message 8 of 8
(601 Views)