Monday, 8 August 2011

Setup and Deployment c#

In this tutorial you will get to know how to make a setup of your c# project.
  •  First of all open your vishual studio and create a new setup and deployment project.

  • When you'll open the project you'll get.The main screen of the project.
  • You can see the three folders Application Folder,User Desktop Folder,User Program Menu Folder.
  1. The User Desktop folder is responsible for showing things of the project on the desktop. 
  2. User Program Menu folder is used to show the project in the start menu.
  3. While user Application folder is use to keep the files and data of application like it's reports forms etc so that the application can run properly.
  • Goto solution explorer.Select View->Solution Explorer from the top menu of the vishual studio.

  •  Select The options as I've shown in the image.A browse dialog will appear in front of you.

  • In this case I've selected my project to deploy you can browse to any of your c# project and select the solution file and open.

  • Now you can see all the files of my project are added to the solution explorer.

  • Right Click on the setup1 in the solution explorer and goto add->project output.
You will see a box appearing like this.

  • Click Ok.
  • The required .dll and .exe to run the project will be added to the application user folder appearing at left side of your project screen. 

  • Right Click on the primary output file and create a shortcut of the file.You can create as many shortcuts as you want.
  • When the shortcut is created you can set the icon of the file from the properties window. 

  • Click on browse
  • A dialog will appear click the browse button there.
  • Another dialog will appear double click the application folder and click Add File.
  • Select the .ico file from your hard drive and press open.
  • Now click ok select the file and click ok again in the outer dialog.
  • So the icon for the application folder is set meaning the where your application will install the following icon will appear for your application.
  • Now if you want your application to appear in a folder on your desktop add a folder to the user desktop folder.And drag the shortcut from that application folder to that folder.
  • Similarly you can set how you want the program to appear in your start menu by using the user program menu folder.
  • When you are done with all this goto build->configuration manager at the top menu of vishual studio and select release from the combobox appearing below the heading Active Solution Configuration.So that your setup.exe will be created in the release folder.
  • You can change your project author and product name(airline in my case) so that your product appears with that name.You can change it by clicking setup from solution explorer and going to its properties window.You'll find these things there.
  • Now goto build and click on build solution from the top menu.
  • You're done.
  • Now goto your setup project folder where you created it goto the subfolder in it.Goto Release folder where you will see the setup appearing.
  • Just Run the setup and install.
  • If everything is done right your project shortcut will appear on the desktop one copy of your project will be in the c:drive and you can access the project from the start menu also.
  • Your project will appear in add/remove control panel also.
  • Don't forget to leave the comments.