Post date: Sep 23, 2014 3:8:39 PM
The caveat emptor, I am a rank beginner at Wix and am writing this down for two reasons
1. I managed to get the installer only after much Googling and trial and error and guesswork
2. and I don't want to go through it all again!
So if someone else does benefit from this and wants to donate money, send it to your favorite charity!
This "reminder" assumes that you have downloaded the Wix Toolset from http://wixtoolset.org/ and that you have a working .exe in the Debug directory together with all the library files and other files that need to make it work in several sub-directories. The final site I checked out before getting the installer to work is http://bestplayah.com/harvesting-files-with-wix-heat/ so I will number the steps in the same sequence and hopefully add more info to make things more apparent (it does mention that the site is "not for complete beginners". For convenience, let's call my app MyApplication and the Wix installer project MyWixInstaller.
1. Open your project in Visual Studio whatever. Add a new project to the Solution (top level). If you have Wix Toolset installed, you will see a "Windows Installer XML" item on the left of the Add New Project screen. When that is selected, a list of Project Types will appear. Select the Wix "Setup Project".
2. Right Click on the added new project and add a reference to the app's .exe. Now is a good time to edit the Product.wxs file. There are many good tutorials on this because this is the fundamental portion of the installer creation process. One good Video tutorial is https://www.youtube.com/watch?v=NKUqW-wCwK0 and another https://www.youtube.com/watch?v=XfwlWUJPmYU . Now that we've got the Product.wxs file out of the way, we can proceed. Note the names for DirectoryRef Id and ComponentGroupRef Id. For the time being, keep the ComponenGroupRef Id as the default ProductComponents.
3. Right Click on the new project again and this time go to properties. On the left pane, select "Build Events". In the Build Events screen, in the Pre-build Event Command Line, add
"$(WIX)bin\heat.exe" dir "$(SolutionDir)MyApplication\bin\$(Configuration)" -dr INSTALLFOLDER -cg SampleGroup -gg -g1 -sf -srd -var "var.MyApplication.TargetDir" -out "$(SolutionDir)MyWixInstaller\Files.wxs"
INSTALLFOLDER is the DirectoryRef Id and SampleGroup is the new ComponentGroup Id. Type the line EXACTLY like it is above with the relevant names changed to suit your project. The $(WIX) was installed on your system on installation of the Wix tools and the $(SolutionDir) and var.Application.TargetDir are all assigned by either Windows, Visual Studio or Wix Tools. Note also that heat.exe is one of the Wix Tools.
4. Now build MyWixInstaller project. If all goes well (no Error's), you will get Files.wxs (or whatever you used for this file name) in the MyWixInstaller directory (Right Click on MyWixInstaller project in the Solution Explorer and go to Open Folder in File Explorer. Now back to Visual Studio and do an Add Existing Item on the Files.wxs or whatever you chose to call it.
5. Step 5 is already done in Step 2 and all you needed to do is to ensure that the ComponentGroupRef Id in the Product.wxs file is the same as the ComponentGroup Id in the Files.wxs file so now change the original ComponentGroupRef Id from ProductComponents to SampleGroup.
6. Build the setup project one more time my installer appeared in the bin\Debug sub-directory of the MyWixInstaller directory.
That was where I finished off. The Project that I made an installer off had like 15 projects in it excluding the installer. Now just one more thing to mention, save yourself a lot of grief by not having any spaces in your path.