Create Setup part 2

In part two we’ll add the wpf-program to our setup.

  1. On the MyWpfApplicationSetup -> Add Reference.

    wix_wpf_application_add_ref

  2. On the tab Projects select MyWpfApplication click on Add and then Ok.
  3. Find the ComponentGroup with the id ‘ProductComponents’ and replace the uncommented xml with the following:
    <Component Id="CMP_MyWpfApplicationSetup">
    	<File Id="FILE_MyWpfApplication.exe" Source="$(var.MyWpfApplication.TargetPath)" KeyPath="yes" />
    </Component>
    

Now we can build the setup and try it! Please note that our setup has no GUI so far.
If everything went fine, you should find the MyWpfApplication.exe in the folder C:\Program Files (x86)\MyWpfApplicationSetup.

Wait, do I have to add each file manually?

Actually yes and no. For fatclient-applications with a reasonable number of files, it is the recommended approach. If you want to create a setup for a software with many files (like i.e. a webapplication), you can use a WiX-tool called heat. We’ll cover it in a later tutorial.

Improvements

You have probably noticed two things. First, the program was installed in the Porgram Files (x86) which is not what you want to have for a modern program. Second, beside the msi-file, a .cab-file was created. They contain parts of your setup, which could be distributed over several medias (i.e. CDs). As we do not want to do this, we’ll include everything into our msi-file.

No .cab files

We can configure this with one additional attribute.

  1. Add EmbedCab="yes" to the mediatemplate-element.

64bit installation

We need to tell the WiX-setup explicitly, that we want to install a 64bit program. Follow these steps to install to the Program Files-folder:

  1. Add Platform="x64" to the package-element.
  2. Add Win64="yes" to the component-element with the id CMP_MyWpfApplicationSetup.
  3. Change the directoryid from ProgramFilesFolder to ProgramFiles64Folder.

Congratulation! You have now a good basic setup, from which you can start of. In the next tutorial you’ll learn, how to add a GUI to your setup!