To create subdirectories in your installation directory, you need to add additional <Directory /> elements under the <Directory /> that says INSTALLDIR. For example:

<Directory Id="INSTALLDIR" Name="MyGame">
  <Directory Id="ContentDir" Name="Content">
  </Directory>
</Directory>

The problem now is that <File /> elements have to be contained in <Component /> elements. So you need to create at least one <Component /> per directory. The above example with files becomes this:

<Directory Id="INSTALLDIR" Name="MyGame">

  <Directory Id="ContentDir" Name="Content">
    <Component Id="EffectsComponent" Guid="<some guid>" DiskId="1">
      <File Id="WaterEffectFile" Name="WaterEffect.xnb" Source="<path to watereffect.xnb>" />
    </Component>
  </Directory>

  <Component Id="RootComponent" Guid="<some guid>" DiskId="1">
    <File Id="GameExeFile" Name="Game.exe" Source="<path to game.exe>" />
  </Component>

</Directory>

Next, to actually install the files in the other components you created, you need to link all your <Component /> elements to a <Feature /> in Setup.wxs. For the above example, it would look like this:

<Feature Id="MyFeature" Title="Required Files" Level="1">
  <ComponentRef Id="StartMenuEntriesComponent" />
  <ComponentRef Id="RootComponent" />
  <ComponentRef Id="EffectsComponent" />
</Feature> 

There is a file editor in SharpDevelop that automatically creates the nodes for your (Menu "View" -> "Setup" -> "Files"), but it creates one <Component /> element for each single file, so it's not exactly a time-saver XD

Last edited Dec 11, 2009 at 7:45 AM by Cygon, version 2

Comments

No comments yet.