Installing Files

by Markus 29. October 2009 23:56

 

How to Install all the Files and Applications in your Product

This is the simple but fuzzy part.

Hint: In the provided sample Project there is a little C# Forms Application called GUIDGen (Source included). This is a comfortable little Tool to generate GUIDs.

 

Step 1

Define the Directories (Folders) to use.

 

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <!--Folder for All Programm Files-->
    <Directory Id="COMPANYROOTDIRECTORY" Name="$(var.ManufacturerFolderName)">
      <Directory Id="APPLICATIONROOTDIRECTORY" Name="$(var.ProductName)">
        <Directory Id="APPLICATIONDATADIRECTORY" Name="DataSubDir" />
      </Directory>
    </Directory>

    <!--Folder for Menu Items-->
    <Directory Id="ProgramMenuFolder">
      <Directory Id="ProgramMenuCompanyFolder" Name="$(var.ManufacturerFolderName)">
        <Directory Id="ProgramMenuAppFolder" Name="$(var.ProductName)"/>
      </Directory>
    </Directory>

    <!--Folder for Desktop-->
    <Directory Id="DesktopFolder" Name="Desktop" />
  </Directory>
</Directory>

 

Note:

  • APPLICATIONDATADIRECTORY is optional and it is just for demonstration of creating a Sub Folder under the Application Folder.

 

Step 2

Define the Files and other things to be deployed. Insert the following code in the Product.wxs or in a Fragment File:

<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
      <Component Id="TheTester_exe" Guid="{90EFC2EE-4AD3-F051-86A0-29C35B823F7B}">
        <File Id="TheTester.exe" Source="..\Bin\$(var.Configuration)\TheTester.exe" KeyPath="yes" Checksum="yes" />
      </Component>
      <Component Id="TheTesterSetupManagerDLL_dll" Guid="{182eaf28-053f-4e02-b187-ba3b3384fabe}">
        <File Id="TheTesterSetupManagerDLL.dll" Source="..\Bin\$(var.Configuration)\TheTesterSetupManagerDLL.dll" Vital="yes" KeyPath="yes" DiskId="1"/>
        <File Id="TheTesterSetupManagerDLL.dll.config" Source="..\Bin\$(var.Configuration)\TheTesterSetupManagerDLL.dll.config" Vital="yes" DiskId="1" />
      </Component>
      <Component Id="InstallUtilLib_DLL" Guid="{182eaf28-053f-4e02-b187-ba3b3384faba}">
        <File Id="InstallUtilLib.dll" Source="C:\windows\Microsoft.NET\Framework\v2.0.50727\InstallUtilLib.dll" KeyPath="yes"/>
      </Component>

       ……

    </DirectoryRef>

    <DirectoryRef Id="APPLICATIONDATADIRECTORY">
      <Component Id="TheTesterData_xml" Guid="{A1244677-9B25-4235-8622-9A0860B37B8F}">
        <File Id="TheTesterData.xml" Source="..\Bin\$(var.Configuration)\TheTesterData.xml" KeyPath="yes" Checksum="yes" />
      </Component>
    </DirectoryRef>

 

Step 3

Compose the Features Tag. Here we have only one Feature, but If you need more just separate the Files in more features. You need to use a different UI to select the Features to install than in this demo!!!!

 

<Feature Id="DefaultFeature" Title="PTTester" Level="1"  ConfigurableDirectory ="APPLICATIONROOTDIRECTORY">
  <!--Installing the Files-->
  <ComponentRef Id="TheTester_exe" />
  <ComponentRef Id="TheTesterSetupManagerDLL_dll" />
  <ComponentRef Id="InstallUtilLib_DLL" />

  <!--Installing DataFiles-->
  <ComponentRef Id="TheTesterData_xml" />

  <!--Installing the Services-->
  <ComponentRef Id="PTTesterService"/>

  <!--installing the Shortcuts-->
  <ComponentRef Id="ApplicationShortcut" />
  <ComponentRef Id="ApplicationShortcutDesktop" />

</Feature>

 

<= Back to Content

Tags: ,

Comments

11/2/2009 9:14:02 PM #

trackback

Home - Wix

Home - Wix

Blog of MaHop.net |

About MaHop.Net

Just look on our Webpage http://www.mahop.net

Tag cloud