Make VDProj .MSI installer copy itself locally after successful install

1.4k views Asked by At

We have large C# application spanning many projects which is packaged into an .MSI file by running MSBuild (or through Visual Studio 2010) on a .VDProj file. The installation usually works fine, and warns correctly if other required software is not found on the local machine.

However, if the installation is successful, we would like the installer to copy itself to some particular folder in program files. For example 'c:\program files\app\version\install_1.2.3.4.msi'.

Does anyone know of any way of doing this?

1

There are 1 answers

1
Cosmin On BEST ANSWER

You can get the MSI path from OriginalDatabase property. To copy the MSI you can use a custom action scheduled after InstallFinalize standard action.

For example, you can write a simple EXE which receives [OriginalDatabase] as a parameter and performs the copy operation.

InstallFinalize is not shown in Visual Studio. You can add your custom action under Install and edit the MSI with ORCA to change its sequence after InstallFinalize in InstallExecuteSequence table.

You can get more control over custom actions by using other setup authoring tools.