Using ClickOnce to Distribute your Game


The two methods of distribution we've talked about so far have both required the person to have XNA Game Studio installed on their computer. While this may be nice for giving the game to your friends who use XNA, this won't work if you are trying to distribute your game to everyone you know. It is not reasonable to expect end users of your game to download Visual C# Express, and XNA Game Studio, just to play your game. So now we will talk about a method that can be used to get your game to anyone, even if they don't have XNA. It is by using Microsoft's ClickOnce technology. This method is one example of a type of game publishing called independent publishing.

Why ClickOnce

At a basic level, ClickOnce is a great choice for distributing your game because it is very easy to do. This is very nice. No configuring, no long drawn-out build process—it's simple and easy to use. But there's more than just that.

One of the nicest things about ClickOnce is that it will also bring along the necessary prerequisites, such as the XNA redistributable, and the necessary .NET framework, and install them if necessary. This is a big deal. Without this, you'd have to go way out of your way to make sure that the user has everything installed that they need, which can be very difficult.

It is worth mentioning, though, that if they don't have the right version of the .NET framework installed, or the XNA redistributable, it may take several minutes for everything to get set up. (I'll admit, I once had a bad experience where I was showing off a game during a job interview, and because they didn't have the right stuff installed, and a slow Internet connection, it took an hour before I could actually show off my game. Usually, though, it is significantly faster than that—several minutes in an "average" worst-case scenario. (If "average worst-case" even makes sense….))

Using ClickOnce to Distribute your Game

ClickOnce is a way that allows the user to download your game off the Internet easily. (They only need to click once! Hopefully…) When you are running the ClickOnce utility, you will see that it is easy to set up your game to be downloaded off the Internet. However, in this tutorial, we will look at another way ClickOnce can be used. We will make an installer that can be put on a CD (or anything else) and installed easily.

To use ClickOnce, in XNA Game Studio go to the Build menu and choose Publish <Project Name>, as shown in the image below.


This will open up a wizard that will guide you through the process of creating your installer for your game. On the first screen, you will need to choose a location to put the file at. Click on Browse and pick a location on your computer to publish to. Then click Next.


On the next screen, shown below, it will ask you how you want the user to install the game. You can see here that there are a few possibilities, including putting the program up on a website. At this point, though, we are going to choose the last option: From a CD-ROM or DVD-ROM, as shown in the image below.


Finally, we need to indicate whether we want the user to be able to check for updates. This works especially nicely if you were putting your program on a website, but can work for a program that is distributed on a CD as well. For now, though, we are just going to say The application will not check for updates. At this point, you can click on Finish, and the installer will be created in the location that you wanted it at.


It will generate several files, including a setup.exe file. You can now place these files on a CD and give (or sell) them to whoever you want. Of course, you could also place these files in a .zip file and email them, or place them on the web for download. When a person gets your program, they simply need to double click the setup.exe file. If you put the program on a CD, most computers will automatically look for a setup.exe file on the CD when you put it in the CD drive, so they may not even have to do this. When they run the setup.exe program, a shortcut will be added to the Start menu.

Unfortunately, the only way for them to uninstall the program is by going to Add/Remove Programs. There is no uninstall.exe that is created.


Using ClickOnce is a simple way to distributing your game to anyone. You can see that it has a lot of methods of distribution available. This method is probably one of the best ways to get your game out, simply because of how easy it is, both for you and for the user.

If you haven't looked at the other tutorials for packaging your game for other XNA users, you might also want to take a look at them now. (There is a tutorial for sending only the playable game, and one for sending the source code to other XNA users. If you have already seen those tutorials, you might want to also take a look at the tutorial about other ways of distributing your game.

Troubleshooting.png Having problems with this tutorial? Try the troubleshooting page!