How To Package Hello World

<< Back to the MSI page

This tutorial gives a step by step instruction on how to package a very simple program executable into an msi file that you can distribute. This is the most basic and vanilla setup possible. Later tutorials will show you how to add considerably more information and include many other files in your msi.

Step 1. Create a hello world program.

  • Open visual studio and create a C# program titled Hello World.
  • Set the Form.Text property to "Hello World"
  • Test it.
  • At this point, your Solution explorer should look something like the inset image

Step 2. Add a Setup and Deployment Project.

  • From the File menu, select Add Project -> New Project to raise the Add New Project dialog box
  • Change the name to something appropriate, e.g., HelloWorldSetup
  • Select the Setup Wizard and click ok.

Step 3. Follow the Wizard.

  • Your previous actions will have started a wizard. Do the following.
  • Welcome to the Setup Project Wizard. Click Next to get past this
  • Choose a project type. Click Create a setup for a Windows application
  • Choose project outputs to include. We will only include the executables and dependancies for now. Click
    • Primary output from Hello World
  • Choose files to include - just click Next, as there are no extra files to add.
  • Create Project should show something like the dialog below. If this summary looks correct, click Finish.

Step 4. Build the HelloWorldSetup.

  • Your Solution explorer should look something like the figure below.
  • You can change many properties of the Setup package from the Solution explorer, but we won't do that now.
  • Right click on HelloWorldSetup and select Build

Step 5. Try the installer

  • Go to the folder where you saved the HelloWorld and HelloWorldSetup projects
  • Open the HelloWorldSetup -> Debug folder.
  • You will see a file HelloWorldSetup.msi. Open it.
  • A standard installation wizard will start. Accept the default actions, although you should note the installation folder from the Select Installation Folder dialog (or change it to someplace convenient).

Step 6. Check the installation

  • Now go to the installation folder where the program was installed.
  • Open the subfolder called HelloWorldSetup.
  • There will be a single file there: HelloWorld.exe. Try it!