As i have this in my wix application it should install the msi file from where it is running . like if i run from D drive it should take SourceDir as D , but it is taking as C only . how to change it to D drive ?
-
in above question this means the following code
– Vedavyas Velaga Aug 22 '16 at 11:30 -
Logs (msiexec.exe /l*v log.txt /i installer.msi) and code snippets would be very helpful. The property you want to use is also "SourceDir" not "Sourcedir" – Brian Sutherland Aug 22 '16 at 19:29
2 Answers
According to this, TARGETDIR will default to the commandline value (if specified), then the ROOTDRIVE (usually C:) then the drive with the largest amount of space available.
The directory you opened your msi from has absolutely no bearing on the value of TARGETDIR which roots your directory installation path. If you want to allow the user to change the installation path you can implement WixUI_InstallDir UI or, using it as an example, implement your own UI. You can also usually make the Install's root folder (Usually the name of the Company or Product itself) have a public ID so that it can be set in the command line. Alternatively you can create a custom action to read the value of SourceDir and force the TARGETDIR to use the root of the SourceDir path (where you launched the installer) however this is not recommended.

- 1
- 1

- 4,698
- 14
- 16
I did this by setting a parameter when I run the installation (My default installation drive was C but sometimes I want to install on D drive):
ReSecServer.msi /L*v log.log APPLICATIONROOTDIRECTORY="D:\Program Files (x86)\XServer"
Here is an example of my directories:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="XServer">
</Directory>
</Directory>
</Directory>

- 181
- 1
- 2
- 14