Search code examples
c#vb.netvisual-studiowindows-installer

Two installers are trying to run at the same time in my Visual Studio Setup


Background:

  • I am using Visual Studio 2019

  • There are a few VB NET and C# projects in my solution

  • One of these projects (InstallDigitalPersona) starts a .msi file when I run it

  • The previous employee left so this project was given to me

  • DigitalPersona is a 3rd Party program. (We just need to run its install before\after our program is installed)

I have a ".msi" setup file that use "Microsoft Visual Studio Installer Projects" in Visual Studio 2019 to be created. When I run the installer the main program starts installing, but about halfway through the DigitalPersona installer also starts. Windows blocks two installers from running at the same time so I have to stop DigitalPersona from installing.

In the past the DigitalPersona installer ran after the main installer was finished but does not do this anymore. The previous person worked on the setup file a bit and left. After he tampered with the setup folder the DigitalPersona installer was no longer running at all.

I added a Primary Output from my InstallDigitalPersona project under Setup > Custom Actions > Commit and now the installer starts halfway through our program's installation.

I have read about msi chaining and other installer programs that can be used to achieve my goal, but it has always worked in the past with "Microsoft Visual Studio Installer Projects" and would like to keep it as it always was.


Solution

  • Ok here is what I did in order to fix my issue. It might not work for everyone as I only picked up someone else's work and did not work on the installer from start to finish.

    • I created a batch file

       @echo off
       IF DEFINED ProgramFiles(x86) goto x64
      
       :x86
       start /wait msiexec.exe /i DigitalPersona32.msi /qr
       goto done
      
       :x64
       start /wait msiexec.exe /i DigitalPersona64.msi /qr
       goto done
      
       :done
       echo "script complete"
      

      and I added it to my setup project.

    • I added my install project as a Primary Output under Commit as well as Install

    • Then I just changed the version numbers in my main project and in my setup project & Build.