Search code examples
c#installationvisual-studio-2019ftdi

Using "Microsoft Visual Studio Installer Projects" to Install FTDI Driver after Installation (Custom Action)


I have been trying to make an installer for my application and I cannot figure out how to successfully add FTDI driver installer.

The installer can be found at https://ftdichip.com/drivers/

I tried to add the installer as a file and include it under custom action (either Install or Commit). When I do so, the installer run correctly and FTDI installer pop up at the end, however regardless of what happens in the FTDI installer, the main installer gives the following error: "There is a problem with this Windows Installer Package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor."

After some reading I realized that this could be due to FTDI driver not sending an exit code 0 upon completion. I wrote a simple script and the exit value was 1.

start /wait CDM212364_Setup.exe
echo %errorlevel%

I tried to make a wrapper in C# (a console application) to run the FTDI driver and mask the exist value but I could not find a way to integrate my console application to run add the end of the installation.

I have tried to read on the documentation for "Microsoft Visual Studio Installer Projects" but it is rather limited and sometimes I do not fully understand it, since C# programming is not part of my daily routine.


Solution

    1. Add the FTDI installer file in the application folder.
    2. Add the installer project, then add install class 3. Override the Commit method with following code in the install class:
      System.Diagnostics.Process.Start($@"{path}CDM212364_Setup.exe"); 
      
      path is a string passed from custom actions.

    This works well for me.