12-04-2018 04:54 PM
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 ?
Solved! Go to Solution.
12-05-2018 04:35 PM
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/
12-10-2018 11:05 AM
Thank you, that works.