How can I find out the location where the msi installer starts

Can someone tell me how I can find out the location where the msi installer comes from.

For example, I have the Sample.msi and Manuals folder in the InstallerExample folder on the desktop.

I need this information so that I can use it in File / @ Source, as shown below.

 <File Id="MyFileId" Name="MyFile" Source="[SourceDir]Manuals" KeyPath="yes" > 

SourceDir should be set to C:\Users\bla\Desktop\InstallerExample\Manuals

It will be great if someone can help me with this.

+4
source share
1 answer

I had the same problem since I wanted my custom action to read the file from which my MSI was, so I needed a path. I was able to find him using

 TARGETDIR 

According to MSDN TARGETDIR documentation

 the root destination directory for the installation 

Also, according to MSDN, SourceDir

 the root directory that contains the source cabinet file or the source file tree of the installation package 

Thus, the SourceDir property points to the actual directory: the one where your MSI file is located. This can be seen in the installer log during installation using msiexec / lvx * installer.log installer.msi.

However, for some reason, SourceDir is completely ignored when TARGETDIR is resolved. TARGETDIR must either be installed explicitly (for example, on the command line), or it enables ROOTDRIVE. If ROOTDRIVE is not specified explicitly, this is the root of the drive with the most free space.

+2
source

All Articles