Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

'NationalInstruments.VisaNS' could not be found in the .NET Global Assembly Cache (GAC).

Trying to use NI-VISA assembly dll in my matlab program for controlling my devices. 

 

ni = NET.addAssembly('NationalInstruments.VisaNS');

 

But throws an error "'NationalInstruments.VisaNS' could not be found in the .NET Global Assembly Cache (GAC)."

 

Tried to use Gacutil to load the assembly to GAC but below error is thrown :

 

gacutil /i c:\windows\system32\visa32.dll
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0
Copyright (c) Microsoft Corporation. All rights reserved.

Failure adding assembly to the cache: The module was expected to contain an assembly manifest.

 

Tried to read the dll using IGSpy Visual studio extension , but below error is thrown. 

ICSharpCode.Decompiler.Metadata.PEFileNotSupportedException: PE file does not contain any managed metadata.
at ICSharpCode.ILSpy.LoadedAssembly.<LoadAsync>d__52.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ICSharpCode.ILSpy.TreeNodes.AssemblyTreeNode.Decompile(Language language, ITextOutput output, DecompilationOptions options) 

 

Anyone please help me run my matlabcode. How to add VISA NI dll to assembly cache. 

 

Operating system : Windows 10

Dotnet : 4.0 

NI-VISA driver version : 21.5

Matlab : 2019/2022 both versions show issue.

 

0 Kudos
Message 1 of 2
(883 Views)

"visa32.dll" is not a managed .NET assembly, so adding that to the GAC won't work. Generally the NationalInstruments* assemblies are wrappers around the base win32 libs (just like the LabVIEW APIs). visa32.dll is one such lib.

 

VisaNS has been deprecated by NI from NI-VISA 19.0 onwards, so I suggest migrating to VISA.NET. It is still possible to use VisaNS via a workaround.

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YIRSCA4&l=en-NZ 

https://www.ni.com/en-nz/support/documentation/supplemental/15/national-instruments-visa--net-librar... 

0 Kudos
Message 2 of 2
(855 Views)