User Tools

Site Tools


user:mgough:deployment

Windows Software Deployment

Objectives

To explain how to deploy, create and installer, and patch software released to the public.

prerequisites

1) Software to deploy 2) Microsoft Windows Operating system 3) Microsoft Visual Studio 4) Web server for hosting the software

Background

If you are a programmer, you will eventually get to the point where you have a wonderful piece of software that you want to share with the world. For the general public this process must be made as easy and painless as possible. Yes, you can zip up all the files and post that on the web, but your software will not show up in the user's start menu, or have shortcuts automatically placed on the desktop, which is what people are used to and expect.

While installing the software, it is also of critical importance to perform a check for dependencies, such as DirectX, and have the installer offer to install or upgrade these dependencies to the required versions. Just because software you write on your computer works, does not mean everyone else is working with the same environment.

In addition to deployment, there should also be an easy way to keep the released software up to date without having the user manually uninstalling the old version and reinstalling the new version. This is the process of patching.

Determining the need to patch software can be done in a few ways, from the user manually checking for updated versions, ex: help→check for updates, to the software checking automatically on start up. The automatic method is convenient for developers in that it takes the human element out of it, but there are many privacy concerns. I personally do not like any software that “phones home” without my explicit direction.

Procedure

Again, like any other project, planning and documenting your steps is key to success. While creating your application it is important to make an organized file structure that will be easy to distribute. If you have files all over your computer in an unorganized fashion it will make installation on remote machines all the more difficult.

Determine what you want installed, of course you want the application and it's dependencies installed, but you also may want to install a license text file, a readme html file etc..

Step 1:

Fire up Microsoft Visual Studio and start a new project: File→New Project

Here you will be presented with a number of project types, including C++, C#, Visual Basic (blegh…) and possibly others depending on your development environment.

In the tree you will find an option called “Setup and Deployment”

From the choices offered, select the “Setup Project”, supply a project name, and click “Ok”.

You will now be presented with the file system editor which consists of two windows, one is the file system on the target machine, and the other is the file system on your local machine. We need to add the files through this interface.

Step 2:

Next, we want to set up our installer file properties. Click the project name on the solution explorer (top right window). Below that you will be presented with a list that includes information such as Author, Manufacturer, Version and many more - this is your place to take credit, so fill it all out!

Step 3:

Now we need to start building up the file architecture for installation on the remote machine. To do this follow the procedure below.

Right click on your project name in the solution explorer and select view→file system.

Right click on the “Application Folder” and select Add→Project Output, this will include your executable.

Repeat and add any dependant files required, such as images, readme files, and the like.

** Your project will most likely require an icon, select it now as well by right clicking on the application folder and choosing add→file.

Step 4:

We will now set up shortcuts to the application that will be installed in the start menu, or on the desktop.

Right click on the right window of the file systems. Choose “Create new shortcut”.

Select the application folder and choose “Primary Output” from “Project name”. This will provide a shortcut to your executable. Click “ok.

To supply an icon to the shortcut, select the new shortcut just created, in the properties window you can then select an icon - click “Browse” and find the application folder, choose the icon we added in the previous step.

If you would like to put a shortcut in the start menu, use the same procedure except choose the “program menu” folder instead of the “user's desktop” menu.

Easy eh?

Step 5:

If your project requires a dependency, such as DirectX if it is a 3d game, we must check to see if that dependency is met.

This is pretty simple too, again, it requires planning. You must know the minimum version required, and exactly WHAT is required.

Select the Launch Conditions tab:

You will see the following displayed:

Requirements on Target Machine

Search Target Machine
     DirectX Version
        Property = DIRECTXVERSION
        RegKey = Software\Microsoft\DirectX
        Root = 
        Value = InstalledVersion

Launch Conditions

 Check for DirectX 9.0 (assuming a MINIMUM version of DirectX 9 is needed)
        Condition = DIRECTXVERSION = 9
        InstallUrl = (leave blank)
        Message = Direct X Version 9.0 or later is required.

Your installer will now check for a minimum installation of Directx v9.0. If it is not found, the installer will exit displaying an error message of “Direct x Version 9.0 or later is required.”

Step 6:

Let's build it!

This is by far the easiest step.

On the top menu select “Build→Build Solution”

You will be presented with output simlar to this:

------ Starting pre-build validation for project 'Setup4' ------ 
------ Pre-build validation for project 'Setup4' completed ------
------ Build started: Project: Setup4, Configuration: Debug ------
Building file 'C:\Users\Weazl\Desktop\Horizons\Setup4\Setup4\Debug\Setup4.msi'...
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

You now have an installer that will have the ability to repair an installation, install a new copy, check to see if dependencies are met, and is easy to use for the casual computer user.

Congrats!!

References

user/mgough/deployment.txt · Last modified: 2011/05/18 20:47 by mgough