Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install application in custom folder using wix installer,other than Program Files folder

I have created an installer using wix. By default the application gets installed under Program Files folder.I need to create a folder for my application under c: directory and install my application inside there.

<Fragment>
      <Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="WINDOWSVOLUME" >
    <Directory Id="INSTALLLOCATION" Name="WIXDemoApp">
    </Directory>
  </Directory>
</Directory>

<SetDirectory Id="WINDOWSVOLUME" Value="c"/>

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">

        <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
         <Component Id="MyApplication.exe">
     <File Source="$(var.MyApplication.TargetPath)" Name="MyApp.exe" Id="MYAPPEXE" KeyPath="yes"  />
            <!-- TODO: Insert files, registry keys, and other resources here. -->
         </Component> 
    </ComponentGroup>
</Fragment>

I am getting the following error "error LGHT0094: Unresolved reference to symbol 'Directory:INSTALLFOLDER' in section 'Fragment:'".

Update:

<Fragment>
          <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="WindowsVolume" >
        <Directory Id="INSTALLLOCATION" Name="WIXDemoApp">
        </Directory>
      </Directory>
    </Directory>

    <SetDirectory Id="WindowsVolume" Value="c"/>
  </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLLOCATION">

            <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
             <Component Id="MyApplication.exe">
         <File Source="$(var.MyApplication.TargetPath)" Name="MyApp.exe" Id="MYAPPEXE" KeyPath="yes"  />
                <!-- TODO: Insert files, registry keys, and other resources here. -->
             </Component> 
        </ComponentGroup>
    </Fragment>

This is giving me another error "error LGHT0204: ICE99: The directory name: WindowsVolume is the same as one of the MSI Public Properties and can cause unforeseen side effects.".Googled and refereed this and this to fix this.But not working for me,still i am getting the same error as "error LGHT0204: ICE99: The directory name: WindowsVolume is the same as one of the MSI Public Properties and can cause unforeseen side effects.".Any idea what would be the problem.

like image 558
Royal Avatar asked Nov 18 '14 12:11

Royal


People also ask

How do I run as administrator in WiX installer?

Setup tab > Run after execution input: your msi file name. Advanced tab > Mark Request Administrative access option checkbox.

How does WiX installer work?

The WiX tools follow the traditional compile and link model used to create executables from source code. At build time, the WiX source files are validated against the core WiX schema, then processed by a preprocessor, compiler, and linker to create the final result.


2 Answers

Windows Installer is case-sensitive so WINDOWSVOLUME won't work. You can do something like this:

<Fragment>
  <Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFilesFolder">
      <Directory Id="INSTALLLOCATION" Name="SetupProject1" />
    </Directory>
  </Directory>

  <SetDirectory Id="INSTALLLOCATION" Value="[WindowsVolume]SetupProject1" />
</Fragment>

For your second error, you're mixing two different ids: INSTALLFOLDER and INSTALLLOCATION. Pick one and use it in both places.

like image 107
Bob Arnson Avatar answered Oct 03 '22 19:10

Bob Arnson


I found this tip on kentie.net - Wix Tips & Tricks. Tips said to use the WINDOWSVOLUME id.

TARGETDIR and the system partition

When trying to install to a subdirectory of the system drive root (e.g. 'C:\application'), it might sense to assume that in something like

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="INSTALLLOCATION" Name="SetupProject1">
    </Directory>
</Directory>

TARGETDIR refers to the system partition, as ProgramFilesFolder is always given as a child of TARGETDIR. This is not the case; TARGETDIR is the partition with the most free disk space. It can even be a partition on an external hard drive. To set it to the true system partition, use the below approach:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="WINDOWSVOLUME" >
        <Directory Id="INSTALLLOCATION" Name="SetupProject1">
        </Directory>
    </Directory>
 </Directory>

<SetDirectory Id="WINDOWSVOLUME" Value="[WindowsVolume]"/> 

The SetDirectory element is required as trying to use WindowsVolume directly results in

error LGHT0204: ICE99: The directory name: WindowsVolume is the same as one of the MSI Public Properties and can cause unforeseen side effects. Signing MSIs

like image 44
Black Frog Avatar answered Oct 03 '22 19:10

Black Frog