Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WIX ComponentGroup subdirectories

I would like to install my application into the following directory structure:

MyCompany/
    MyApp/
        assembly1.dll
        assembly2.dll
        assembly3.dll
        ...
        plugins/
            plugin1.dll
            plugin2.dll

For this, I defined the following folders:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFilesFolder">
        <Directory Id="CompanyFolder" Name="MyCompanyName">
            <Directory Id="INSTALLFOLDER" Name="MyProduct">
                <Directory Id="PLUGINS" Name="plugins">
                    <Directory Id="DATABASE_PLUGINS" Name="db" />
                </Directory>
            </Directory>
        </Directory>
    </Directory>
</Directory>

Now I have defined 1 feature with a reference to a component group. This component group has a property "Directory" pointing to "INSTALLFOLDER". But when I now declare a component in the component group that has also a "Directory"-property (pointing to DATABASE_PLUGINS), VS won't let me build the setup.

<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
    <Component Id="DB.Connector.Extension.Plugins.SqlCe" Directory="DATABASE_PLUGINS" Guid="{ae87be28-b0c9-4b3e-915f-2b4bf9965c99}">
        <File Source="$(var.DB.Connector.Extension.Plugins.SqlCe.TargetDir)DB.Connector.Extension.Plugins.SqlCe.dll" KeyPath="yes" />
    </Component>
</ComponentGroup>

How can I achieve that the setup creates a subdirectory inside my main install directory and puts declared files into it?

like image 257
Atrotygma Avatar asked Aug 20 '13 12:08

Atrotygma


1 Answers

here is my full example I hope this help further developers

</Product>
  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFiles64Folder">
        <Directory Id="GiladDir" Name="Gilad">
          <Directory Id="INSTALLFOLDER" Name="App">
            <Directory Id="BIN" Name="bin"></Directory>
          </Directory>
        </Directory>
      </Directory>
      <Directory Id="ProgramMenuFolder" Name="Programs">
        <Directory Id="ProgramMenuDir" Name="App">
          <Component Id="ProgramMenuDir" Guid="*">
            <RemoveFolder Id="ProgramMenuDir" On="uninstall" />
            <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" KeyPath="yes" />
          </Component>
        </Directory>
      </Directory>
  </Fragment>
  <Fragment>
    <ComponentGroup Id="group_tools">
      <ComponentRef Id="comp_tool_dll" />

    </ComponentGroup>
    <DirectoryRef Id="INSTALLFOLDER">
      <Directory Id="bin" Name="bin">
        <Directory Id="Release" Name="Release">
          <Directory Id="Plugins" Name="Plugins">
            <Component Id="comp_tool_dll" DiskId="1" KeyPath="yes" Guid="*">
              <File Id="file_comp_tool_dll" Source="$(var.ReleaseSourcePath)\Plugins\tool.dll" />
            </Component>
like image 61
Gilad Avatar answered Nov 11 '22 05:11

Gilad