Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

C# - Deploying Your Project via VS Setup Wizard ( Installer )

  • Please log in to reply
1 reply to this topic

#1 CommittedC0der


    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1065 posts
  • Programming Language:C#
  • Learning:C#, JavaScript, PL/SQL

Posted 14 August 2011 - 12:26 PM

Hello everyone, today we'll be learning how to setup a basic installer for our program via Visual Studio 2008 Setup Wizard. This is one of the easiest ways to create an installer for your program, but it does have one large requirement:
  • Visual Studio 08/10 (cannot be express editions)
If you have this then let’s go! :)

Adding the wizard.
Firstly you should have the project you’re looking to create an installer for open. Once open we need to add our Setup Wizard by going to File>Add>New Project, and selecting Setup Wizard from the "Setup and Deployment" category.

Name the wizard according to your application(Adding "Install" to the end is nice for the user, e.g. "AppName Install")

You will now be presented with a welcome screen which asks you to click next. Now we have the "project type" screen which presents us with four options of how the files will be installed on the computer. For this tutorial we are creating a normal Windows applications so we'll chose option one. The next screen is the "project output" screen which asks what project output we want to include. For this tutorial all we'll need is Primary output(the exe).

Note: If you click on the other options a small description will be shown.

With the next screen we are allowed to add files such as readMe or html pages. I’m going to add a readme just because I want to, I'll then press next.
All that left now is to check the last screen to confirm everything is filled in correctly and press next.

If everything went well you should see this screen.

This is where we'll edit some details to install the program where and how we want.

First let's add a shortcut to the desktop and program menu. Double click the "User's Desktop" folder from the left and you'll be shown the content of the folder on right(blank atm). Right click this blank area and click "Create New Shortcut" and a new dialog will open. With this dialog we must select what we want the shortcut to connect to, in this case the application, so in the dialog double click the "Application Folder" and select "Primary output..." press ok and name the shortcut(The text you want show on your desktop icon).

Now lets add an icon to our shortcut! Right click your shortcut and open the properties window, from here choose "(browse)" from the icon property. Once again a dialog will open, from this dialog we go into the application folder again and click add file. We then browse for the icon we want and press ok.

Now you can repeat the process for the "User's Program Menu" folder to place a shortcut on the program menu.

File Path
Now that we have some shortcut's lets change the installation path of our files. Right click the "Application Folder" and open the properties window. Near the middle you should see "DefaultLocation" filled in with
"[ProgramFilesFolder][Manufactur]/[ProductName]" this sets the file path to
"C:\Program Files(x86)\Micorsoft\SetupWizardName", but as it turns out you probably don’t work for Microsoft and may not want your program folder named after the Setup Wizard. Let’s change the value to "[ProgramFilesFolder]MyCompanyName/MyAppName". There, now you have your files right where you want them.

Once you’re done editing and adding, right click your Setup Wizard in the solution explorer and click Build!

There you have it, that’s the basics of creating a setup wizard for your application! If some people would like I could make a tutorial going into some more detail about other options of the wizard e.g.

Congratz you now have an installer worthy of being online! Your installer can be found in "Wherever\Visual Studio 2008(or 2010)\Projects\ProjectName\SetupWizardName\Debug\".

Any questions, comments, or rep welcome.

Thanks and good luck ~ Committed. :)
  • 1
There IS a war going on for your mind.
Nothing of eternal significance happens besides prayer.

#2 John


    CC Mentor

  • Moderator
  • 4450 posts
  • Location:New York, NY

Posted 16 August 2011 - 11:20 AM

Very nice. The screenshots make it really easy to follow.
  • 0

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download