Can anyone tell me how can I find out the location from where the msi installer is being run.
For example I have my Sample.msi
and Manuals folder in the folder InstallerExample on the Desktop.
I need this information so that I can use it in File/@Source, like the one given below.
<File Id="MyFileId" Name="MyFile" Source="[SourceDir]Manuals" KeyPath="yes" >
SourceDir
should have value C:\Users\bla\Desktop\InstallerExample\Manuals
It will be great if anyone can please help me with this.
I just had the same problem as I wanted my custom action to read a file from where my MSI was so i needed the path. I was able to locate it using
TARGETDIR
According to the MSDN documentation TARGETDIR is
the root destination directory for the installation
Also according to MSDN, SourceDir is
the root directory that contains the source cabinet file or the source file tree of the installation package
So the SourceDir property points to a real directory: the one where your MSI file sits. You can see this in the installer log when installing with msiexec /lvx* installer.log installer.msi.
However, for some reason SourceDir is completely ignored when resolving the TARGETDIR. The TARGETDIR must be either set explicitly (e.g. on the command line) or else it resolves to ROOTDRIVE. If ROOTDRIVE is not explicitly set then it is the root of the drive with the most free space.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With