14

Can someone help me understand how WiX works? I have a directory structure which I would like to create an installer for. I have generated the for the directory structure with heat.exe and when I build the setup project it generates an .msi file but I don't think it installs anything.

Maybe someone can walk me through the steps of generating a .msi installer.

Any advise is appreciated, Thank you

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
Alin
  • 342
  • 1
  • 4
  • 12
  • Good answer from Phil, perhaps you can check this answer too: http://stackoverflow.com/a/22550256/129130 – Stein Åsmul Feb 09 '15 at 20:34
  • And this one to understand the history of Wix: http://stackoverflow.com/questions/6060281/windows-installer-and-the-creation-of-wix/12101548#12101548 – Stein Åsmul Feb 09 '15 at 20:41
  • And finally an old Wix tips and tricks thread: http://stackoverflow.com/questions/471424/wix-tricks-and-tips?rq=1 – Stein Åsmul Feb 09 '15 at 20:44

6 Answers6

14

If you're using Visual Studio:

  1. Install the WiX Toolset V3 Visual Studio plugin.
  2. Install the Wax interactive editor.
  3. Build your project if you haven't already.
  4. Add a new project to the solution containing the project you want to create an installer for.
  5. Choose the template Setup Project for WiX v3.
  6. Name the installer. A personal convention is the name of the project plus ".Setup"
  7. A Product.wxs file will open up. Change the Manufacturer="" value to something like your company name or your name. Keep the file open.
  8. Go to Tools -> WiX Setup Editor
  9. On the left under Root Directory choose InstallFolder
  10. Under Projects to install, choose the project you want to install.
  11. In the red area to the right, you'll see a list of files. These are the output results of your build from step 3.
  12. Click the plus sign next to files you want to copy. They should turn white and change to a Resolved state.
  13. This might look daunting, but you're just telling it what to copy--which would be your project's executable, configs, dll libraries, and images it's dependent upon.
  14. You typically want to copy everything. If there are dll's you know you don't need, it's better to remove them as a dependency from the Visual Studio.
  15. Notice the Product.wxs has changed. It now has the files you checked off in the Setup Editor GUI added to the <Wix><Fragment><ComponentGroup> section. Save that file.
  16. Close the Setup Editor.
  17. Build the setup project you just configured.
  18. Open Windows explorer and go to that project's bin/Debug or bin/Release folder, depending on what mode you built in. There you'll see the .msi that you can copy to where you need.

To make an update, make the necessary changes and then change the version number in that project's Properties -> Application -> Assembly Information. Then also change it in Product.wxs <Wix><Product.Version>. Then just build your setup project again.

Chad Hedgcock
  • 11,125
  • 3
  • 36
  • 44
  • 1
    Note for Step 1 you need to install "Wix Toolset Visual Studio nnnn Extension" as opposed to "Wix Toolset Build Tools". I ended up installing both. – Den-Jason Oct 09 '20 at 12:43
  • 1
    A good tool for creating the basic file listings, but it lacks the ability to define shortcuts, registry edits, and icons. Use it to generate the template which you can then edit to add additional functionality manualy. – Reahreic Feb 09 '21 at 18:06
10

Good tutorial here:

http://wix.tramontana.co.hu/

http://www.codeproject.com/Tips/105638/A-quick-introduction-Create-an-MSI-installer-with

They should get you started.

If you learn something about the MSI log that will also help - install the MSI with a command line that includes /L*vx

And "doesn't install anything" should be easy to check - are there are any files installed, or did it create an entry in Programs&Features?

PhilDW
  • 20,260
  • 1
  • 18
  • 28
7

WiX is a language (XML/XSD) that serves as a way of authoring (compiling) Windows Installer (.MSI) databases. WiX doesn't install anything, MSI does.

I maintain an open source project called IsWiX. The concept is simple. IsWiX provides additional WiX project templates (scaffolding) and graphical designers to assist you in creating installer. Then as you gain knowledge of WiX and MSI you can make additional tweaks of the WiX XML by hand and go beyond what IsWiX currently knows how to author.

Here's a video showing how to author, build and test an MSI to deploy an IIS website in a mere 3 minutes.

Update: IsWiX has tutorials now.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • 1
    here's a direct link for future users to the IsWix tutorial that exists on GitHub https://github.com/iswix-llc/iswix-tutorials. (It astounds me that Wix had zero UX considerations at all. Thank you for making the tool) – Reahreic Feb 09 '21 at 17:37
5

After a few 'false starts' trying to learn WiX from online tutorials I noticed that on http://wixtoolset.org/ there is a link to the book "WiX 3.6: A Developer's Guide to Windows Installer XML". You can buy it pretty inexpensively in E-book form from Packt, or also Amazon if you like the easy interface with Kindle.

I found this book to be VERY helpful with every little step regarding the .msi creation process. The book will guide you to create your first .msi in the very 1st chapter! Granted, you have to continue a little more to have a fully functioning .msi, but given the complexity of Wix, this book is terrific. It may not be for the gurus among us, but for those of us who need a little more help to understand the material it's wonderful. I've seen many posts speak to the 'steep learning curve' regarding WiX and it is a complicated process to create a valid .msi, but this book goes a long way toward making that learning curve very bearable.

Alan
  • 1,587
  • 3
  • 23
  • 43
0

If you are using the build system 'cmake', then you can use cpack to generate .msi file by setting the cpack generator to wix.

0

What worked for me best, was this fantastic tutorial video: https://www.youtube.com/watch?v=6Yf-eDsRrnM Its best selling points for me was