Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to access NationalInstruments.DAQmx.dll

Solved!
Go to solution

 

I am using NI-DAQmx with a custom software application created in Visual Studio Code using C# (.net 4.5).

I have included  the two DLL files NationalInstruments.DAQmx.dll and NationalInstruments.Common.dll in the project as dependencies in the .csproj file. However when I try to access the file which tries to access any API's withing the DAQmx.dll I get  the exception:

 

{System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> <CrtImplementationDetails>.ModuleLoadException: The C++ module failed to load.
---> System.EntryPointNotFoundException: A library name must be specified in a DllImport attribute applied to non-IJW methods.
at _getFiberPtrId()
at <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* )
at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
--- End of inner exception stack trace ---
at <CrtImplementationDetails>.ThrowModuleLoadException(String errorMessage, Exception innerException)
at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
at .cctor()
--- End of inner exception stack trace ---
at Nov.Aquisition.Base.NiDaq.NIDAQ..ctor()

 

My dev Enviroment is ( Windows 10 64 bit)

Installations on my computer:

Visual Studio Code:1.29.1 (x64)

Measurement and Automation Explorer : 18.5.0f0

 

Any suggestions ? What amI missing ?

0 Kudos
Message 1 of 3
(3,130 Views)
Solution
Accepted by topic author Subha007

Hi Subha007,

 

I think you want to add DAQmx as a reference rather than as a dependency. I've linked a page about referencing DLLs in Visual Studio below.

 

Creating and Using DLL (Class Library) in C#
https://www.c-sharpcorner.com/UploadFile/1e050f/creating-and-using-dll-class-library-in-C-Sharp/

NickelsAndDimes
Product Support Engineer - sbRIO
National Instruments
0 Kudos
Message 2 of 3
(3,093 Views)

Thank you, that works.

0 Kudos
Message 3 of 3
(3,073 Views)