FTDI Community

General Category => Discussion - Software => Topic started by: Nebr on March 22, 2023, 03:14:38 PM

Title: FTD2XX_NET.DLL - how do I make it work?
Post by: Nebr on March 22, 2023, 03:14:38 PM
Hello, I have a seemingly very basic problem that I was unable to solve. I want to program an MX-Series II device with the help of the D2XX driver. I have seen that there exists a C# wrapper, the FTD2XX_NET.DLL. So i downloaded the wrapper and tried to create a very simple console app just to test the proper working:

    var myClass = new FTD2XX_NET.FTDI();
    string desc;
    myClass.GetDescription(out desc);
    Console.WriteLine(desc);
    Console.ReadLine();

I added a reference to the FTD2XX_NET.DLL to my project and also installed the D2XX driver by downloading and executing the driver file CDM212364_Setup.exe. The drivers were properly installed in my temporary driver store (C:\Windows\System32\DriverStore\FileRepository), so it seems that this worked. But when I run the program, I get the error message

"Attempting to load FTD2XX.DLL from:
C:\MyConsoleApp\bin\Debug\net6.0
Failed to load FTD2XX.DLL.  Are the FTDI drivers installed?"

Referencing the ftd2xx.dll in my project won't work ("The reference is invalid or unsupported"). Putting the dll into the bin\Debug\net6.0 folder does not change anything. I even tried to import the DLL directly via DllImport:

[DllImport("ftd2xx.dll")]
static extern uint FT_ListDevices();

However, I only get a System.BadImageFormatException.

I also tried to get the example codes provided working, but I failed as well. The USBTransfer example shows exactly the same problem with the AID.DLL.

I seem to be unable to get this working. What am I doing wrong? Can anybody help me here?

Version info: I am using Windows 11 Pro and Microsoft Visual Studio Professional 2022 (64-bit), Version 17.4.4. The wrapper version is FTD2XX_NET_v1.2.0.
Title: Re: FTD2XX_NET.DLL - how do I make it work?
Post by: FTDI Community on March 23, 2023, 04:19:37 PM
Hi Nebr,

MX-Series II is an OEM device that is not made by FTDI, but it does seem to be using one of our chips inside. the issue may be that the device is using a custom driver. could you please send me a USBView (https://ftdichip.com/utilities/) screenshot of the device plugged in please and i can check the VID/PID.

You can also reference our C# examples. They can be found on our website here: C# Examples (https://ftdichip.com/software-examples/code-examples/csharp-examples/).

Best Regards
FTDI Community
Title: Re: FTD2XX_NET.DLL - how do I make it work?
Post by: Nebr on March 24, 2023, 10:45:19 AM
Hello,

thank you for your response! I have the same problem with the C# example: I can't work with example 1 because the file AID.dll is not found or not accepted as reference (exactly the same behavior as described with the ftd2xx.dll. I feel like I am doing something fundamentally wrong...

Please find the requested USB View screenshot in the attachment.

Best regards


EDIT: I seem to have solved the problem. The drivers I downloaded seem indeed to have some issue. I have installed the Rheodyne Titan Valve Control Software and now it works with the drivers the software installation process installs.
Title: Re: FTD2XX_NET.DLL - how do I make it work?
Post by: FTDI Community on March 24, 2023, 04:41:21 PM
Hello,

Example 1 is provided by a Third Party.

Can you try Example 3 which uses the FTDI C# wrapper?
Please also update it with the latest C# wrapper found at the top of the page.

I'm glad to read that you have solved the original problem though.

Best Regards,
David Paterson