Jump to content

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

- - - - -

  • Please log in to reply
1 reply to this topic

#1
CommittedC0der

CommittedC0der

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,565 posts
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.
Attached File  addNewWizard.png   60.54K   128 downloads

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).
Attached File  output.png   59.72K   114 downloads

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.


Details
If everything went well you should see this screen.
Attached File  filesSetupWizard.png   33.87K   107 downloads

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


Shortcuts
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).
Attached File  addShortcut.png   74K   118 downloads

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.
Attached File  addIcon.png   87.46K   84 downloads

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!
Attached File  buildInstall.png   26.89K   82 downloads


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.
Attached File  moreDetails.png   38.6K   81 downloads


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. :)
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.

#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
  • Location:New York, NY
Very nice. The screenshots make it really easy to follow.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users