In part two we’ll add the wpf-program to our setup.
- On the MyWpfApplicationSetup -> Add Reference.
- On the tab Projects select MyWpfApplication click on Add and then Ok.
- 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.
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.
EmbedCab="yes"to the mediatemplate-element.
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:
Platform="x64"to the package-element.
Win64="yes"to the component-element with the id CMP_MyWpfApplicationSetup.
- Change the directoryid from
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!