Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

ni4882.dll Problem add references C#

Hello,

 

We have a software(C#, .NET Framework 2) with the old gpib-32.dll file, which runs on a 32bit system, now we would like to update this software to a 64bit system and also with a new adapter ( GPIB-USB-HS ). This adapter only supports the ni4882.dll file and isn't compatible with the gpib-32.dll. Now the problem is, if I try to add the ni4882.dll to the project in Visual Studio 2010 (Project -> add Reference) I always get the same error: "A reference to %path% could not be added. Please make sure that the file is accessilbe, and that it is a valid assemlby or COM component. ", how can I fix that? or is there any other way to add the 4882.dll file to the project?

 

Thanks

 

0 Kudos
Message 1 of 7
(6,317 Views)

Hello IMT_Buchs,

 

your problem seems to be an issue with the Visual Studio 2010 software.

I found out that you can add a DLL (or EXE) to a project only if it is a .NET assembly. If it's not you will see this error message.

There is a way which possibly allows you to add the dll. Please try the following steps:

 

  • Open cmd (Click Start and type "cmd" in the search bar)

  • Find TlbImp.exe. Probably located in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin. If you can't find it go to your root folder (C:\ or D:) and run:

    dir tlbimp.exe /s              //this will locate the file.
  • Run tlbimp.exe and put your dll behind it. Example: If your dll is ni4882.dll. You can run:

    TlbImp.exe ni4882.dll
  • A new dll should be created in the same folder of tlbimp.exe. You can maybe use that as reference in you project.



    Please let me know if it worked for you.

    Regards,

    Eduard Gross
    NIGermany
0 Kudos
Message 2 of 7
(6,290 Views)

Hallo EduardGross

 

Thank you very much for your Answer, I've also tried this before but unfortunately it did not work. I always get the error "TLBIMP: error TI0000: The input 'C:\Windows\system32\ni4882.dll' is not a valid type library."

 

Regards,

 

IMT_Buchs

0 Kudos
Message 3 of 7
(6,265 Views)

Hi IMT_Buchs,

 

sorry to hear this didn't work for you. As I said that this is some problem that has to do with Visual Studio and not our .dll file, which should normally work out just fine.
In this matter I can just try helping you with a solution I have to search in the MS Forums and else.
There again I found some advice which helped some people with this error message in VS2005, maybe it will work out in VS2010 as well:

Step 1) Add the DLL as a resource.  To do this open the project, select the resources tab, select "add existing file" and add the DLL as a resource.

 

Step 2) Add the name of the DLL as a string resource.

 

Step 3) Add this code to your main form-load: (In this example my project is called "USBXpress_TestPanel", and the DLL file I'm using is "SiUSBXp.dll").

 

Code Snippet

if (System.IO.File.Exists(USBXpress_TestPanel.Properties.Resources.DLLName + ".DLL") == false)

{

System.IO.StreamWriter OutStream;

System.IO.BinaryWriter BinStream;

// Create the DLL file

OutStream = new System.IO.StreamWriter(USBXpress_TestPanel.Properties.Resources.DLLName + ".DLL", false);

BinStream = new System.IO.BinaryWriter(OutStream.BaseStream);

BinStream.Write(USBXpress_TestPanel.Properties.Resources.SiUSBXp);

BinStream.Close();

}

 

__________________
I did not try this myself and I can't guarantee it works.. but I hope it will do for you.

Regards,

 

Eduard Gross

National Instruments

0 Kudos
Message 4 of 7
(6,244 Views)

Hi IMT_Buchs,

 

did the last post bring you any further or shall i keep looking for a solution?


Regards,

Eduard Gross

National Instruments

0 Kudos
Message 5 of 7
(6,205 Views)

Hi Eduard Gross

 

No... but i found a solution for the problem, the ni4882.dll is the old dll of National Instruments, so i downloaded the newest version of the National Instruments Software, which includes the new Nationalinstruments.ni4882.dll. With this DLL the References Import works and i can connect my GPIB-USB-HS with the computer software.

 

Thank you very much for your help!

 

regards ,

 

IMT_Buchs

0 Kudos
Message 6 of 7
(6,201 Views)

I'm having a similar problem with ni_opcua_client.dll.

 

When I run a web site  in VS2008 referencing a interop ddl built in Labview I get the message:

 

"Missing Dependency in: Read.vi: Library not found or failed to load: ni_opcua_client.dll"

 

I try to place this dll in every place I could figured out but the message remains. I get the same error in VS2010 Express.

 

 

When I run a form it just crash instantly with the message:

 

vs error.png

 

The dump files are attached.

 

TlbImp.exe call result in invalid error.

 

 

I'm running LV2012 (without SP) in a WS2008 R2.

 

Thanks.

 

0 Kudos
Message 7 of 7
(5,837 Views)