Create Setup and Deployment Project Visual Studio 2008

Posted by VIJI Monday, March 1, 2010


Creating a Setup and Deployment Project
In this article I will cover the basics of creating a Windows Installer. This article will explain the step by step process of creating a Setup Project.


Step 1: Create a Sample .Net Project. I have named this project as "TestBlogProject".











Figure 1 Sample Project


Create a Setup Project
Open the TestBlogProject in the VS IDE.





Figure 2: Add New Project




Figure 3: Setup Project Dialog


There are five different templates that are available when you select the project type 'Setup and Deployment Projects'.
  1. Setup Project: Creates a Windows Installer project to which files can be added. This project type is the most generic of the five.
  2. Web Setup Project: Creates a Windows Installer web project to which files can be added.
  3. Merge Module Project: Creates a Windows Installer Merge Module project to which files can be added. This project type is most commonly used for using third party products.
  4. Setup Wizard: Creates a Windows Installer project with the aid of a wizard.
  5. Cab Project: Creates a Cab project to which files can be added.
For the purpose of this article, I will be using the template Setup Project. Provide a name for the project as well choose the location where this project will be established. (See Figure 3) Once you have done this click 'OK' and you should now see a screen like the following.

 




Figure 4: Default Setup Project File View


Now that we have an empty Setup Project established.
Let us discuss about the various editors that are available.



  1. Right Click on the Setup Project and Click View.

Figure 5: File System Editor


  1. Click on the File System

File System Editor
The File System (Figure 6) provides you the essential tools to work with the application folder, user's desktop, and the user's programs menu.




Figure 6: File System Editor

The first thing we want to do here is to include the relevant files and folders we wish to install on the user's machine. This is accomplished by right clicking the Application Folder and selecting 'Add'. The following screenshot is an example of something similar you may see.



Figure 7: Add Project Output

Now to add project output files to this folder, Click Project Output.



Click OK.

Merely add one or more of the files that is vital for your application by clicking on File…. Now that you have you files in place.


Figure 8: Project Output


We could take additional steps such as manipulating the user's desktop with items such as a shortcut, as well you can add a program group to the user's program group.

Create Shortcut





Name the shortcut as you want. I have given the name as TestBlog. Drag and drop to User's Desktop Folder

Figure 9: Desktop Shortcut to application


The next item you find of immense importance is the User Interface Editor. Inside of this editor you may eliminate or include dialogs that are needed for this install project. The following screenshot is the default User Interface that is created when I initially created this setup project (See Figure 10). The only variation is that I have added a Customer Information dialog.

Figure 10: User Interface Editor
To include the Customer Information dialog that I spoke of follow the following steps.
  1. Under Install right click on the 'Start' node
  2. Choose 'Add Dialog'



Figure 11: Customer Information


  1. Select the Customer Information Dialog and click 'OK'
As you can see there are is an ample variety of dialogs you can choose from.


Prerequisites Installation in Windows Installer
Most applications have prerequisites: Components such as the .NET Framework runtime must be available on a target computer in order for the application to run. The deployment tools in Visual Studio include the capability to automatically detect the existence of components during installation and install a predetermined set of prerequisites — a process known as bootstrapping.


This will be achieved as follows:


To choose which prerequisites to install
  1. In Solution Explorer, select the deployment project and Right Click
  2. Click Properties.
  3. In the Property Pages dialog box, expand the Configuration Properties node, and then select the Build property page.
  4. Click the Prerequisites button.
  5. In the Prerequisites dialog box, make sure that the Create setup program to install prerequisite components box is checked.
  6. In the Choose which prerequisites to install list, check the prerequisites that you wish to install, and then click OK.
To specify the download location for prerequisites
  • In Solution Explorer, select the deployment project, right click.
  • Click Properties.
  • In the Property Pages dialog box, expand the Configuration Properties node, and then select the Build property page.
  • Click the Prerequisites button.

  • In the Prerequisites dialog box, choose a location:
    • If you want to deploy the installers for the prerequisites to a vendor, click Download prerequisites from the component vendor's web site.
    • If you want to deploy the installers for the prerequisites to the same location as your application installer, click Download prerequisites from the same location as my application.
    • If you want to deploy the installers for the prerequisites to a different location, click Download prerequisites from the following location and enter a local path, URL, or file-share location.
  • Click OK to continue.











In this article, I have covered adding a new setup project, about File System Editor, adding installer prerequisites to Windows Installer.

107 Responses to Create Setup and Deployment Project Visual Studio 2008

  1. LW Says:
  2. Great stuff - really helped me out.

     
  3. I am glad my article helped you.

     
  4. TINASHE G Says:
  5. tintin:
    fantastic,this is good stuff!

     
  6. Anonymous Says:
  7. How do you integrate a dialog with textboxes, adding this dialog is a simple as what you do, but at some point you need to acces the properties (e.g. EDITA1, EDITA2,...) how do you do this? In my case I want to enter a "default" value in the texfield that depends on the windows version on the PC. The user can if needed change this value but ofcourse I need to be able to read it afterwards (e.g. when the program is booted).

     
  8. manoj Says:
  9. Great !!!!!!!.
    How can we create a setup that can only be installed on one and only one computer.
    THank a lot for ur appreaciation.
    Manoj

     
  10. Anonymous Says:
  11. great..Thanks a lot..=D

     
  12. Anonymous Says:
  13. Nice post can u please explain how to customize the Prerequisites.

     
  14. I am glad my article helped you

     
  15. Adi Artech Says:
  16. Please help me. i have set the prequisites install location --- i have selected *download prequisites from the same location of my application. Please help me.

     
  17. sadhish Says:
  18. how i can add some third party installer in prerequisites such as xampp, joytick drivers...... its must automatically install while instaling the software.
    thank you

     
  19. Anonymous Says:
  20. Hi there,

    I am wondering, If I need to amend again my project(change some codes) do I need to run the setup again? Kindly advise .

     
  21. Anonymous Says:
  22. I did everything but i can't publish the Project setup1. how can i do it?

     
  23. Anonymous Says:
  24. Hi,
    I did used, but no solution

     
  25. Anonymous Says:
  26. Thanks But please tell tthat should i add my MS Access Database in Project output.Bcause if i dont add my database in project output then i receives eroor that database not found

     
  27. Anonymous Says:
  28. Thank you so much. You are a life saver. I was about to commit suicide you know. Just exaggerating.

     
  29. terminatorz Says:
  30. How to add ms access database and microsoft viewer report in setup?
    Please help

     
  31. Anonymous Says:
  32. how to add a sqlserver database into my setup please help

     
  33. Anonymous Says:
  34. where is the set up file created

     
  35. Anonymous Says:
  36. how to add a sqlserver database into my setup please help

     
  37. joydev Says:
  38. HOW TO ADD SQL SERVER INTO MY PROJECT(WINDOWS APPLICATION BY C#) AND AFTER INSTALLATION IT INTO DIFFERENT COMPUTER, HOW TO SOLVE REMOTE CONNECTION ERROR. PLEASE HELP ME.

     
  39. Anonymous Says:
  40. Thanks for your article

     
  41. Anonymous Says:
  42. Hi there,
    I have developed an Excel add-in using MATLB, after I am done with deployment I am left with a dll and the addin. Now, I want to distribute the dll, excel add-in and a Compiler called the Matlab Compiler runlime (MCR), so that the user can install the compiler and run the add-in that was developed. Can I make a set up project that will install the MCR (160 Mb) in a pirticular location of the users machine and copy the dll and the add-in file aswell in that location?

    Regards,

    Karthik

     
  43. Hi.
    Can Anyone tell me how to I create My won Instaling Interface????not using Visual Studio Defalt Instaling Interface...

     
  44. Anonymous Says:
  45. Is there any way to create multilingual setup project in VS ??? (i mean using VS default Setup Project) Without Using Wix or any other tool.

     
  46. Divyesh Says:
  47. Hello Dear..
    i have created on project with sql database.
    and when i create setup as above than after an installation i faced an error in connection of database...
    i have already use |DataDirectory| for dynamic conection of file.

    then plz tell me how create an setup of project with sql databsefile.

    send me email on
    divyesh07163@gmail.com
    dvsbharadva@gmail.com

    hopping to be favoured me and thanking to you.,..

     
  48. Divya Says:
  49. how to add a sqlserver database into the setup
    please help me...

    send me on
    libra.diya@gmail.com

     
  50. Quiz Mania Says:
  51. how to get desktop shortcut after installation & it has a icon too ?

     
  52. Anonymous Says:
  53. how to add a sqlserver into setup and also how to add Serial Number while setup wizard going on..i mean how add serial number to application in VB.net

    plz help me
    send me answer at atulparmar19@yahoo.co.in

     
  54. Anonymous Says:
  55. according to my knowledge you have to put the sql server in installing machine first and then should mannually put the database.i use a sql scripts and run it to put my db on that machine..any comments on this??

     
  56. thx but i want to include my DB with that EXE??????? Can u help me

     
  57. Anonymous Says:
  58. How to deploy a vb.net 2008 project with the SQL server-2005 database... I am able to deploy using above procedure but my database is not getting connected.. Il b glad if u could help me...

     
  59. Anonymous Says:
  60. how to deploy a software with sql database??

     
  61. Anonymous Says:
  62. Good Stuff

     
  63. Anonymous Says:
  64. Good Article thankyou :-) helped me a lot.

     
  65. muneer Says:
  66. Hi, Thanks its very help full to me.

     
  67. Tapan Dubeyt Says:
  68. thanks its really helped me

     
  69. prashant Says:
  70. i have problem with deployment before deployment everything run ok but when i deploy project & show the report this time its shows Load Report Failed can u help i think in my deployment there no show all the form

     
  71. Anonymous Says:
  72. I want to add a confirmation dialog box for the application version.if previous version is available then ask to remove the previous version.

     
  73. Migra Says:
  74. To attach your 'Access' database: In the figure 4 of this tutorial -> right click on 'Application Folder' -> select 'File...' and then search the *.mdb file on your hard disk. When you compile (Debug or Release) it will copy the database to the App Folder, voilá!. Do the same for the App Icon and configure the shortcuts by looking into this folder for the icon. For SQL databases I'm not sure this same process works, I'll try tomorrow to see if it works, what I'm sure is that you need to enable SQL Server Express on 'Prerequisites' on the last picture in this tutorial, because for SQL you need the server installed and the database attached to it!

     
  75. money arora Says:
  76. hi ,everyone i m don't understand these concept please explain it............

     
  77. Anonymous Says:
  78. Thanks a lot..U did a Nice job,It is really helped us..once again thanks

     
  79. Anonymous Says:
  80. hola alguien sabe ya como incluir la base de datos SQL!!

     
  81. upendra Says:
  82. hi .please help me
    how to add sql database with set up file

     
  83. Anonymous Says:
  84. hi please help me
    I have 2 problems

    1) How can we create a setup that can only be installed on one and only one computer


    2) HOW TO ADD SQL SERVER INTO MY PROJECT(WINDOWS APPLICATION BY C#) AND AFTER INSTALLATION IT INTO DIFFERENT COMPUTER, HOW TO SOLVE REMOTE CONNECTION ERROR. PLEASE HELP ME.


    please send me the steps for these problems.

    My mail id : suresh_gotika@yahoo.co.in

     
  85. Anonymous Says:
  86. HOW TO ADD SQL SERVER INTO MY PROJECT(WINDOWS APPLICATION BY C#) AND ,HOW TO CREATE A LICENCE KEY IN SETUP.. PLEASE HELP ME.
    TO SEND DETAIL-
    My mail id - shiva.chauhan@gmail.com , mydemo.niit@gmail.com

     
  87. HOW TO ADD SQL SERVER INTO MY PROJECT(WINDOWS APPLICATION BY C#) AND ,HOW TO CREATE A LICENCE KEY IN SETUP.. PLEASE HELP ME.
    TO SEND DETAIL-
    My mail id - shiva.chauhan@gmail.com , mydemo.niit@gmail.com

     
  88. Anonymous Says:
  89. thanks for being so much helpful.
    From: www.kaszona.com

     
  90. Anonymous Says:
  91. We would be much obliged if you could include a step by step procedure on how to effectively include the need for a serial in the setup... Thank you

     
  92. Anonymous Says:
  93. Can you give me a link for download? (Setup Project)

     
  94. Sena Says:
  95. Best Guide Ever.. i have been looking around for days. Maybe the other explains it well too, BUT its impossible to understand for beginners. And this type of Manual/Guide are always for beginners. Thanks again for your time. AND AS I SAID, BEST GUIDE ever

     
  96. Anonymous Says:
  97. How can we create a setup file which will work with both 32 and 64bit

     
  98. Ace Nasir Says:
  99. any idea how to include the run as administrator option in the setup.exe file? iv tried looking everywhere and even tried searching for software which modifies the binary iv found software and modified the binary detalials of the setup.exe but still no luck adding run as administrator to the right click menu items of the setup.exe

     
  100. Avinash Says:
  101. Thanks... it helped me a lot :)

     
  102. Rahul Ganga Says:
  103. hi guys nice helping ..
    my problem is the client computer not having any configure of .net frame work and service pack 3 and no sql server..
    i made a simple program in my system of ado.net
    this program is running in my system but not running in another as client systme why?
    and how to attach a local db space for client

    plz help us ..??

     
  104. i think u can attach file with the help of "download prequisites from local location" and then browse ur mdf file from the system then add....


    hope it works! tc.

     
  105. Anonymous Says:
  106. Really good article

     
  107. Anonymous Says:
  108. Great! Thank You :)

     
  109. Anonymous Says:
  110. Thank you sir.....This article is really helpful.....You did an awesome job....:)avi

     
  111. tonyng Says:
  112. I have followed what have said how to do the setup.
    How do I publish it with my project? When I do the build publish, it is still the same. it doesn't do what I put in the setup.

     
  113. zaibashar Says:
  114. Call us at We24Support E-mail support number at 1-866-978-0799 and Enhance your system functioning and keep it clean with We24Support services.
    E mail Setup and Support
    email support

     
  115. Anonymous Says:
  116. HOW TO ADD SQL SERVER INTO MY PROJECT(WINDOWS APPLICATION BY C#) AND ,HOW TO CREATE A LICENCE KEY IN SETUP.. PLEASE HELP ME.
    TO SEND DETAIL-
    My mail id - rajeshk997@gmail.com

     
  117. Gangadhar Says:
  118. This is very nice but how to give the serial number validation in the customer information.

     
  119. tomjerry741 Says:
  120. thanx alot , guy

     
  121. Anonymous Says:
  122. This is the very good steps to deployment vs project.
    thanx a lot sir...

     
  123. emi_me Says:
  124. hey check this new website www.countcode.com. It's a social network made for programmers, where you can download,share or upload source codes, where you can count your own code lines for free. You have access to the web forum and the web chatroom. we are happy to have you joined to our community!

     
  125. Thanks for sharing, it saves my time.

     
  126. DD Says:
  127. Thanks a lot for this topic, but I have a question:
    How can we create a setup that can only be installed on one and only one computer?
    please If you can help me by send steps of this method, because I search via Google several times with no success.
    My e-mail : dd_hefzy@yahoo.com

    Thanks again

     
  128. Anonymous Says:
  129. Great !
    How can I change the text in the installer page like welcome screen.
    e.g. In welcome screen I want 'Welcome to my project 1 Installation' and for other client I want 'Welcome to my project 2 Installation'.
    Is there a way to do it using single setup project???

     
  130. Anonymous Says:
  131. i have a problem

    after i install it. some of the codes change, so the first deploy must be in update.. how to update your first deploy with the new one?

    pls.. email me..likasjemboy@yahoo.com.ph

     
  132. Anonymous Says:
  133. How to add the all dll and how to set the registry value to regeditor atomatically

     
  134. Anonymous Says:
  135. Hi
    How to set the Regedit value atomatically from installed path.Plz help me...

     
  136. Anonymous Says:
  137. Hi sir

    How to add the dlls and main exe.And locate the database and ini file using setup and deployment.Please help me ..

    Solution to mail me
    sabaritky@gmail.com

     
  138. Rajeev Kumar Says:
  139. Thanks...Its helped me a lot...!!!!

     
  140. Anonymous Says:
  141. nothing helped

     
  142. thanks a lot... it helped me...

     
  143. This walk through was very helpful!!!! Thank you so much for posting!!!

     
  144. abhijeet Says:
  145. I written windows service in c# which reads some data from registry.Then I created windows installer using visual Studio 2010 for that service and also adding data to registry required for service. My problem is installer starts installing service before adding data to installer which causes failure in installing the service.I wanted to add data to registry before installing service so that it can use that data.

     
  146. Anonymous Says:
  147. Can anyone tell me how to import the SqlServer database tables into the setup wizard in visual studio 2010 for windows application?
    cause when i create the setup(installation file) ,after installing, my installed application crashes as database is not include during setup creation.

    my mailid is samuraisau@yahoo.co.in

     
  148. Shakib Says:
  149. Hi,
    Dear Friends i have complete my C# project and its working great,
    I have three project such as BLL Project,Interface Project and Win form project.
    Now i want to make a Setup / Installation file of my Completed C# project.how can solve the problem. Please help me. please sent the solution in my Email. shakibmist@gmail.com

     
  150. Monsterinco Says:
  151. Greetings,

    Thank you so much for this tutorial. Very straight forward. :D

     
  152. Ashwin Says:
  153. Good article.. but how do we add the log information for the installer. This would be required when i am packaging the installer / vsix for some project.

    reply is highly appreciated.

     
  154. Goody Says:
  155. Thanks....this was helpful!

     
  156. suresh goud Says:
  157. i wanna create a setup file with key in visual studio....can anyone send me steps to achieve my requirement through email.
    my mail id is: sureshgoud14@gmail.com

     
  158. suresh goud Says:
  159. How can we create a setup that can only be installed on one and only one computer...?

     
  160. Anonymous Says:
  161. Code to create free and Trial version

     
  162. Anonymous Says:
  163. Awesome Article, thankyou for sharing

     
  164. Anonymous Says:
  165. thanks .. this was a good article
    I have a query
    In my project I have created my database in MYSQL (freeware) and connected it through mysql connector now I want to create a setup of my project, is there any way to embed mysql server application to my current project so in one setup file my current project and the server both should be installed in clients computer.

     
  166. Anonymous Says:
  167. In my project i have created my database in sql express 2005 for windows application bulid in visual studio 2008.now i want to create a setup of my project to embed sqlexpress in my project.so that there will be no need to install sql server .

     
  168. saimanohar Says:
  169. Hi All
    In my project i need to create a user inteface and validate textbox filds (username , email , passwprd , conform password)during setup and deployment.

    I am able to create a user interface dialog (using orca) , In installer class i written the logic for validating user input after click on next button
    if user given wrong input able to display the error message box
    information.
    but problrm is after displying error msg installation was not stopped. I want to stay back at same dialog if user enters wrong input.
    Thanks in Advance

     
  170. hi,
    I have developed an application using vs 2012 and access database.I am not good in exe file creation..Kindly help me to create the exe file and runing steps..

    Jeeshma

     
  171. Anonymous Says:
  172. hi,
    how to create setup if crystal reports is used in project.

     
  173. hi, i just want to use sql server 2012 express in our prequesties list to select in setup. is that possible in vs 2008 setup and deployment

     
  174. Zarin Fatma Says:
  175. Thanx it helped me

     
  176. Nice Articel.

     
  177. aparna john Says:
  178. Hi, nice method for Creating Setup and Deployment Project Visual Studio 2008.This method also helps in Visual studio 2010.Thanks....

    -Aparna
    Theosoft

     
  179. Mahesh Reddy Says:
  180. my data base connection is SqlConnection sc = new SqlConnection("Data Source=MAHESH-pc;Initial Catalog=mahesh10am;Integrated Security=True");.........
    how to create setup file with database also , and i want to install client system...please help me ,


    thi is my mail id::- mbollapu@gmail.c0m

     
  181. Anonymous Says:
  182. very nice..........

     
  183. Girdhari Says:
  184. how to give own product key in customer information dialog box ...................when we making the setup ......product key is security of the software

     
  185. Zarin Fatma Says:
  186. hi can any one send me how to create info file that means when i create setup and install it into machine then some info file will also create at that machine.?????

    Guys i need help please have a look

     
  187. thanks

     
  188. Anonymous Says:
  189. thanx a lot............. for ur free stuff ............

     
  190. It is very nice post this blog
    website designing company in India

     
  191. very nice information this post
    website designing company in India

     
  192. Anonymous Says:

  193. hi this is a tejas
    i m last year bscit students
    i m developing two stand alone system(Windows application) one is housing management system and second gym management system using c# for front end & sql server 2008 management studio for back end….
    both project are completely done without any error and bugs..

    but i have face problem for setup(.exe file) to both projects…

    my problem is my poroject has install & working properly on my pc

    In another pc install successfully but not working properly..

    error is database can not found..

    anyone can help me to how to create proper setup of c#…..

     
  194. Hi Sir,
    I m Nadeem Ansari,
    How to set Key when we should create setup in visual studio.
    Please help...

    nadeemansarikjn@gmail.com

     
  195. Unknown Says:
  196. Hello Sir,

    I am maij shaikh

    I want to create a setup file including prerequisites in a way that is compatible for both 32 bit and 64 bit machine. And one exe can be used for both machines

    Please reply on
    maij_shaikh@rediffmail.com

    Thanks in advance..

     
  197. hi i have an issue
    Could not load file or assembly EPPlus , version=4.0.4.0 , culture=neutral ,public key token=ea159fdaa78159a1 or one of its dependencies. the system cannot find the specified file .
    help me with this issue
    thanks in advance

     

Post a Comment