# How do I create an installer for my XNA demo?

I have a demo coded in XNA3.1 using VS2008. I'd really love to be able to send this to anyone with a PC and let them install and run it without requiring them to have VS installed or the .Net framework etc.

I thought it would be the publish option but I'm a little confused by it. Can anyone shed some light on the matter?

• Anything made with XNA requires the XNA Framework to run, so they'd have to install .net framework and the XNA framework. They wouldn't need Visual Studio. – thedaian Oct 3 '11 at 11:08
• that's slightly misleading. You're right in that they would need the xna framework and possibly the .net framework etc. But they wouldn't need to install it themselves per se - that's the whole point of making an installer; it checks dependencies and installs them as necessary. In this case that includes the redistributed XNA framework. – SirYakalot Oct 5 '11 at 12:37

There are a number of ways to create an installer for anything, including an XNA game.

## 1. Visual Studio Deployment Solution

This one's is fairly straightforward. If you have the Professional edition of Visual Studio, then you can add a Deployment project to your solution and whenever you compile this project, it will compile all necessary dependencies/assets for you and make you a nice installer at the end of it.

This link has most of the information that you would need to get started and contains information about redistributing the .NET framework and other related bits and pieces.

Pros:

• Integrated into Visual Studio
• Straightforward in getting a simple MSI installer built and ready to distribute

Cons:

• Not available in some versions of Visual Studio
• Difficult to get your installer to do something more complex than installing/repairing/uninstalling.

## 2. WiX

If you don't have the option of creating a Visual Studio Deployment project, due to a limited version of Visual Studio, there are a number of free alternatives available. WiX is one of these alternatives.

It stands for Windows Installer XML and can be integrated into Visual Studio, much like the VS Deployment projects. This also creates an msi installer after compilation. Be warned though, WiX has a steep learning curve, but it does allow for various complexities in your installer.

You can find out more about it here

Pros:

• 100% free.
• Powerful. If you want to do something ridiculously complex in your installer, just create a C# DLL, link it into your WiX project and run it as a Custom Action. (Almost) Anything is possible.
• Integrates into Visual Studio nicely, works very, very well with .NET projects.
• People on the WiX mailing list provide a lot of support.

Cons:

• Difficult to grasp and get started due to the steep learning curve.
• Errors are almost nonsensical when you start out and it takes a while to actually figure out what the real problem in your code is.
• Not enough tutorials on the subject. Most (in my opinion) are badly worded, badly structured and downright confusing.

## 3. NSIS

NSIS is a fully featured installer creation package. I'll admit, I've barely used it, but when I did it was a pleasant experience. There are a good amount of tutorials, it's completely scriptable, but I'd probably say it's not as powerful as WiX (if anyone feels this isn't the case, then feel free to correct me).

It's completely free and open source and you can find more information on it here.

Pros:

• 100% free.
• Scriptable installer, so you should be able to code some complex behaviour.
• Good amount of tutorials, good support.
• Doesn't make an MSI, but an EXE instead (MSI's can be bad)

Cons:

• Doesn't make an MSI, but an EXE instead (MSI's can be good)
• Fairly limited by the scope of the scripting commands

## 4. InstallShield and InstallAnywhere

I've never used InstallShield, but for completeness' sake, I thought I would mention it here. My only experience is from what people have told me, so I won't list out the pros and cons.

As far as I'm aware, it is pretty fully featured, however it is unable to handle a large amount of files (> 1000). You do need to pay for it though. InstallAnywhere is a cross-platform version of InstallShield. More information here.

## 5. Other Solutions

I'll list the other solutions for deployment here if anyone has any others to add:

Advanced Installer - The freeware version allows for basic deployment solutions. Thanks for this addition, pek.

## Conclusion

There are a whole host of options available to create an installer for your XNA game. Try out a couple, see what you get on with most. However, the most important thing regarding the creation of installers is ensuring that it works on a number of computers. If you're creating an MSI installer, testing is made much easier by running the msi from the command line using the following command:

msiexec /i [name of installer.msi] /L*v verbose_log.txt


This will write out a log of every single event that the installer is going through, which you can then diff from whatever diff tool you like.

In conclusion, see what fits you and your workflow best, testing is key, and whenever you're testing your installer, always, ALWAYS log the installations (most of the time installers never give you any useful information as to what went wrong).

This turned into something longer than I expected, and I am sorry. But I do hope it helps.

~Ray

• Here is another installer tool that you might want to add for completeness: Advanced Installer (advancedinstaller.com). A lot of things can be done with the user interface and for simple projects it's enough. Haven't used it for anything complex. The freeware edition has almost anything a simple project needs, so I was fine with that. – pek Oct 3 '11 at 16:15
• "Visual Studio Deployment Solution" actually refers to two separate technologies - ClickOnce, and Windows Installer. Windows Installer creates a normal-looking installer wizard; it is more widely used and more professional-looking. ClickOnce is easier to use, includes the ability to automatically update the program, and can install directly from a webpage. However, ClickOnce is .Net only (doesn't support native C++ projects) - since XNA is also .Net only, this shouldn't be a problem.. – BlueRaja - Danny Pflughoeft Oct 3 '11 at 17:14