Windows – Creating a windows installer for a Visual Studio project

installationvisual-studio-2008windows

I want to create an installer for my project, primarily to handle the external dependencies which are starting to grow in number.

The problem is most of these components seem to be distributed in different manners, so I need an installer that can cope with all the following. Ive looked at various things around, however many dont seem to cover all the things I need (like how to install directX using a Visual Studio setup project…), or dont even create a proper windows installer (eg .msi).

  • Copy all my apps files to the target directory
  • Create start menu and desktop shortcuts
  • Install direct x (ie call dxsetup.exe /silent)
  • Install the VC9 CRT redist (seems to be a "merge module" looking at msdn whatever that is…)
  • Only requires administrative rights if one of the following is true
    • DirectX and/or the VC9 CRT is not already present, or needs updating
    • Installing for all users
    • Installing to a directory the user doesnt have write permission for
  • Can roll back everything if installation is aborted before completion
  • Generates an uninstaller as well as an installer
  • Ensures the user accepts all required EULA's (my one, VC9 Redist, DirectX, etc)

For example I got the VS2008 Setp Project working for my app files and the VC9 CRT, however I dont see anyway to tell it to just run dxsetup.exe with the /silent argument and NOT extract it and all the other dx installer to the app directory or something…

EDIT:

Also it would be really nice if I could have a unified installer for x86 and x86-64, which installers the correct components (eg myapp_x86.exe or myapp_x64.exe) depending on if the OS is 64bit or not.

EDIT2:

Forgot to mention but either a free or low cost solution would be welcome as well, since I need a solution for some of my smaller personal stuff as well.

Best Answer

WiX is what you want. You'll want to read through the v3 documentation and examples, as it is not a simple thing to use. Once you get going, you'll have follow-up questions which you should post as new questions.

See also the WiX tutorial, but keep in mind it refers to v2, and a lot of it is out-of-date or obsolete in v3.