How to Create Setup file(.Exe File) from Windows Forms Application

By
This is the most important tutorial for creating the Setup File(.exe file) from windows forms application.You can easily install it any windows computers.You can use it only windows platform.
Now i am going to convert these windows forms application to the Setup File. Friends who have not read my previous tutorials please read  first this tutorial and download it, otherwise you will not understand correctly.For read the previous tutorial .
There are some steps to create Setup File From windows forms applications. please follow these steps carefully. 

Step1:-  First open your windows form application in your visual studio.Here i am using visual studio 2010 and my windows forms application Name is "test",which had made in previous tutorial.you can download it Click download. 
Now i am going to open "test" application in visual studio 2010,my "test" application is on desktop. See it carefully and open your application together.



Step2:-  Now open "test" application in visual studio 2010,which is given below, follow it. Open visual studio 2010->File->Open project/solution->select the application "test"Folder_> click open.
See it:-


Step3:-  First see Form1.cs,Form2.cs and Solution Explorer window for remember previous post.
Form1.cs:->

Form2.cs:->


Step4:-> Now open solution explorer(if not open)->Add New Item->Select Application Configuration File->Click Add 
See it:->

See App.Config File:-It is used for creating connection to the database. It is optional.

Step5:- First create table in database,here i am already created "RAM"table in previous tutorial.See it:



  • write the connection string for creating the connection database table "RAM" in app.Config file.if You want to create otherwise  escape it
See it:->



Step6:-  Now this is main step to create the step. Open Solution Explorer->Click  on 'solution'test'('project)->Add New Project->Select other project types from left window->Select visual studio Installer->Select the setup Wizard-> write your setup name in below(mysetup)->click OK.




Step7:- 
  •  One wizard will be opened->click 'Next' Button.
See it:-


  • Select Radio button "Create a setup for a windows application" ->Click Next.
See it:-


  • Select "Primary output from text"-> Click Next.
See it:-

  • Click Add Button->go your application folder,which you want to create setup.
See it:-

  • Select the "App"File from your project ("test")-> click Open Button.
See it:-
  • Now click Next Button.
See it:-
  • Click Finish Button.
See it:-


  • Now click Application Folder From left side window.
See it:-

  • Go right side window-> Right mouse click ->Add file->select icon file (extension . icon) , This icon will  show on Your desktop when you install the setup on computer.
See it:



  • Now create shortcut file of "Primary Output File" by l Right mouse click on  Primary Output File.
See it:



  • Now  change shortcut folder, here i have changed 'mysetup'.
See it: 


  • Now Right mouse click on ' mysetup' Shortcut and go property window.
See it:  

  • Click Icon and  select browse.
See it: 

  • Click Browse Button.
See it: 

  • Click Application Folder and select "mysetup"Icon file->click OK.
See it: 

  • Again select icon file and click OK button.
See it: 

  • Drag and drop 'mysetup shortcut' User's Desktop (left side window).
See it: 
  • Now again create shortcut primary output->rename it again mysetup ->  again add icon File from the mysetup property window as before we have added.
See it: 




  • Now Add New Folder in "User's program menu"(left side window) and  change Name it as setup->Now again Drag and Drop mysetup shortcut  to the setup.
See it:  

  • Now go "Solution Explorer window"-> Right mouse click on mysetup->Click Build. wait some time whenever setup is not successfully build-> Your setup is build successfully->Go and open your application Folder("test").
See it: 



  • click mysetup:-
See it:- 

  • ->Click Debug Folder.
See it:-   

Step8:- Before installing the setup you First install .NET FRAMEWORK 4.0 on your system,Click here for download . whenever you install this setup on your window (OS) and open it then you will see like this:-


Note:-I have seen that many student face problems.Read below link.
  1. Add Sql Database(.mdf)
  2. Sql Server 2008 Problem
Step9:-If you want you can create setup file in visual studio 2012 and visual studio 2013 also.
For More...
  1. Print the Grid Data in Windows Forms Application
  2. How to build real form filling application in asp.net like IBPS
  3. Create .dll File and Use in Asp.net Application 
  4. Take Print receipt in Windows Form Application
  5. File Handling Real Application
  6. Create Setup File(.exe) with SQL Database(.mdf)
  7. How to implement WCF Services in asp.net application
  8. How to implement form based authentication in asp.net
  9. How to implement caching concepts in asp.net application
  10. How to implement cookie in asp.net application
  11. Transaction in sql server
  12. Web Form control in asp.net
  13. Operator over loading in c#
  14. Multithreading in c#
  15. How to implement session state in asp.net application
  16. How to use secure login page in asp.net with example
  17. How to Add and verify Captcha image in 3 tier architecture in asp.net
  18. How to use virtual keyboard in asp.net for security purpose
  19. How to implement hashing concepts in asp.net
  20. Learn complete .Net Interview Questions and answers for job seekers
  21. Learn complete Python course from your home
I hope this is helpful for you.
Please share this with your friends ,its may be helpful for them.

To Get the Latest  Free Updates Subscribe
           Download Attached whole setup file:-
                    DOWNLOAD

131 comments:

  1. i did not want install sql server ,then how to create a set up with database file (.bak file)

    ReplyDelete
  2. Excellent Dude...........!

    ReplyDelete
  3. Hey..I have developed a windows app which will use sql server dataabse...My doubt is how to add the database info to the setup file???

    ReplyDelete
    Replies
    1. select your DB file when you are adding project output file

      Delete
  4. If I don't want to use App.config file then what is the procedure?

    ReplyDelete
  5. Nice Post..thanks

    ReplyDelete
  6. but if install application into another system..then its giving me an error..like database can not open...the login failed...
    pls rpl...

    ReplyDelete
  7. great example sets arerpose here for practice purpose

    ReplyDelete
  8. How Can I add dot net framework4.0 to the setup file

    ReplyDelete
  9. i did not want install sql server ,then how to create a set up with database file (.bak file)

    ReplyDelete
  10. i am new to windows application.. i developed a small project is maintain a details of guest. i want to create a exe. and one more i design a database in vs2010... not a sqlserver..
    after install into client system it make a error... "no database is found or db is exist or unc share". how can i solve this problem..
    if i do successfully, then i don't need to sql server on my client....please help me frnds

    ReplyDelete
    Replies
    1. Friend! add sql server database in the setup file when you are creating the setup in windows form application.

      Delete
  11. windowsxp service pack 2 can instal this setup file

    ReplyDelete
  12. yes, you can install but first install .NET framework 4.0 on xp service pack 2.you can download this setup from Step7. first install it after that install setup.

    ReplyDelete
  13. thanx brother... my only doubt is if i include the database file in the setup.. will i still require to install sql server 2008 as my database is in it.... and how to change the connection to the database when i install the application on different computers...

    ReplyDelete
  14. Yes brother,sql server 2008 is required without sql server verification you can not open the connection so your setup will give error. first you install the sql server on the computer where you want to install this setup.create same table name,column and row as your sql server table name,column and row. before creating the setup,first you insert sql server name for connection after that create the setup then you can easily install easily the setup without any error.

    ReplyDelete
  15. superb..!!!!!!

    ReplyDelete
  16. how to add access database in vs2008

    ReplyDelete
    Replies
    1. read this:
      http://www.msdotnet.co.in/2013/04/how-to-solve-problem-to-add-sql.html

      http://www.msdotnet.co.in/2012/08/how-to-add-sql-database-mdf-in-aspnet.html

      Delete
  17. hi,
    i have created the .exe file of my application. Now i want to run it on LAN. I used windows xp sp3, vs2010,management studio 2008 r2, when i,m going to run software on lan that time it give me error of connection string. in connection string i give the servername like "max-d7444sb\sqlexpress initial catalog..... exe.mdf" but it not work.
    plz help me for this problem.

    ReplyDelete
  18. @amit gurav
    go your APP.config file and change your connection string as given below:
    ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString

    and ADD system.Configuration file in your solution explorer

    then create setup .it will work.

    ReplyDelete
  19. Hello sir,
    Thanks for the replying. It is help full for me.
    How can i add image in crystal reports?
    version 2010.
    vs2010

    ReplyDelete
  20. hi,
    your suggestion is use full for me. Thanks for replying.
    I want to add image in crystal reports2010, how can i add it?

    version
    crystal report2010
    vs2010

    ReplyDelete
  21. @amit gurav
    which model you are using for making crystal report.
    1. Push model
    2. pull model
    I will upload crystal report post within few days.

    ReplyDelete
  22. Hi Verma .how i can create a setup file for virtual printer?is it possible to create in windows application?in that virtual printer print button click on print it stores the data in our database it is possible plz let me inform thanks in advance...

    ReplyDelete
  23. sir, I have developed a windows app which will use sql server 2008 database , created and
    installed setup file in another PC then its giving me an error..like database can not open...the login faild but i do not want to install server 2008 completely, i want to install
    database through setup file. please give me reply

    ReplyDelete
  24. i have a c# windows form application including access 2007 database ,
    application is working fine,
    but problem is,
    now we want to run this application through LAN,
    in LAN connection,there is one server,
    the query is --->> only from the server user can edit/update and after updation all the database automatically updated in all the connected pc..
    how can i do this??
    can you please help me in this!!!!
    remote base access

    ReplyDelete
  25. nice article dude.... very good for beginners..........

    ReplyDelete
  26. hello sir,
    In my project if i click on print button then it show the preview in rpt file. Now i dont want preview. So how can i print the page directly on clicking print button?

    ReplyDelete
    Replies
    1. @amit gurav,first visit:-www.msdotnet.co.in/2012/06/how-can-take-print-receipt-and-save.html
      after that go step 9 and delete the button codes:-
      CaptureScreen();
      printPreviewDialog1.ShowDialog();

      after that write the following codes:-
      CaptureScreen();
      printDocument1.Print();

      and save the application. you can directly print the documents.

      Delete
  27. how to make setups which can run on any window computers without installing .net framework

    ReplyDelete
  28. Thanks a lot it was gret example,but wheb i was run set up on windows 7 pcs then set not working

    ReplyDelete
  29. it is working all windows platform,but you will have to install .NET Framework4.0/4.5 first on your system.

    ReplyDelete
  30. I want to add sql server 2005 database file with setup which will fetch data from database...what should i do?

    ReplyDelete
  31. v gud..its really very easy to learn..thanks

    ReplyDelete
  32. thanks very useful post thanks a lot

    ReplyDelete
  33. @Nishinta Parikh , you can add sql server 2005 as 2008 visit:-
    http://www.msdotnet.co.in/2013/07/how-to-create-setup-fileexe-with.html

    ReplyDelete
  34. hi Ramashanker , I have created a windows application and i added a database of sql server 2005. I want to create a setup file with that database but i don need to install the sql server on the clients system.. for that what should i do??

    ReplyDelete
    Replies
    1. Read this post:-
      http://www.msdotnet.co.in/2013/07/how-to-create-setup-fileexe-with.html

      Delete
  35. How can i Create Setup through VS2012

    ReplyDelete
    Replies
    1. Follow above steps,it is same for visual studio 2012 also.

      Delete
  36. i am creating windows application and using my sql as a back end.
    how can i create exe file and after installed it on client machine which has no my sql installed, how can i access database from main(target) system.
    please help me!!

    ReplyDelete
    Replies
    1. read this post:-
      http://www.msdotnet.co.in/2013/07/how-to-create-setup-fileexe-with.html

      Delete
  37. Thanks dear its really helpful

    ReplyDelete
  38. hi i am akash and i am fresher and i have no idea for dot net how to work and at all process so please suggest me all process because VB ,my sql Installation and how to stating and all activities.

    please suggest me.

    ReplyDelete
  39. hello sir i m jais from delhi and i want create a exe software in visual studio 2010 so please tell me how i m doing this and where i start this task .???

    ReplyDelete
    Replies
    1. @jais singhg , install visual studio 2010 in your system-->follow each step which i have explained above.....you can install this on your system.

      Delete
    2. crystal report not working in setup file???

      Delete
  40. Dear Sir, There is no 'Primary Output from Text' option in the 3rd screen of 'Setup Wizard'. How to get it?

    ReplyDelete
    Replies
    1. Hi rose,if Primary Output from Text' option is not present ,create it by right mouse click...........

      Delete
  41. hello sir ,
    how to i create a report form in visual studio 2012 ?

    ReplyDelete
  42. how can i create upload and download form

    ReplyDelete
  43. how its works on other system with database???? plz reply sooon..

    ReplyDelete
  44. i have intalled the .NET Framework 3.5 version.....will this application work?????

    ReplyDelete
    Replies
    1. i have created this setup from visual studio 2010.so you have required .NET FRAMEWORK 4.0/4.5.If you create this step from visual studio 2008 then it will work .NET FRAMEWORK 3.5/4.0/4.5.

      Delete
  45. i have created an setup with attached service based database name sclrd.mdf but when i goes to run setup it shows the exception-Unhandeled exception has occured in your application .
    An attempt to attach an auto name database for file C:\program\Default Company Name\sclrd.mdf failed .A database with this name is already exists. or specified can not be opened,or it is located on UNC share.

    ReplyDelete
  46. Sir please tell how to create setup file using VS 2012 also

    ReplyDelete
    Replies
    1. hi Manjunath ! follow same steps in visual studio 2012.all steps are same.........

      Delete
  47. I have created myfolder as per above information(Tutorial) And That folder contains following items:
    Application Files -folder
    dotnetfx40client -folder
    sqlexpress2008 -folder
    windowsinstaller3_1 -folder
    windowsinstaller4_5 -folder
    PayrollManagementSystem.application (Application Manifast) -file
    setup.exe

    It works but i want to make a application logo on my PC desktop when i installation is complete.
    how can i do this?

    ReplyDelete
    Replies
    1. Hi Prajakta ! First download icon file (logo) from internet or create it custum which you want to show on your desktop pc after installation the setp file.
      I have mentioned this on step 7.Read Step 7 carefully all points and implement it on your setup file.it will work definitely..

      Delete
  48. Excellent Great job....!! Thank u sooo Muchhhhhhhhh....!!!!!!!!!

    ReplyDelete
  49. Is the above info(tutorial) useful when my project has database in SQLexpress2008 ?

    ReplyDelete
  50. You've done a great job thanks a lot.

    ReplyDelete
  51. Suppose I want to add database to my application and then create the Installer. Now my client (system on which the installer/setup has to be run) is not having any SQL server installed. What can I use to store data? Are XML or txt file the only solution?

    ReplyDelete
    Replies
    1. you can include database in installer file.read below post:-
      http://www.msdotnet.co.in/2013/07/how-to-create-setup-fileexe-with.html

      Delete
  52. I have created setup file. but i need "Version update" when we Reinstall the setup again like 1.0.0.0. because of which i can directlly install a setup file instead of Uninstalling the older setup and again installing the new setup.

    ReplyDelete
    Replies
    1. hi Naresh ! Create setup file in visual studio 2012 ,In this ,version update is available.Read below post and create setup file in visual studio 2012.I have already build a calculator application ,you can check it on your system...

      Delete
  53. hi ,
    when i create setup as your above artical but it give error when i run the setup of my project that is "An error occured loading a configuration file: Access to the path 'C:\Program Files\Default Company Name\ Setup1\cstyx5cw.tmp' is denied.(c:\Program Files\Default Company Name\setup1\cms.exe.config)"

    please help me how can i solve this problem ? tell me about that

    and i am trying to create setup file of my project with database but every time this error will detect and on client pc i can not run application sucessfully. please give any solution

    ReplyDelete
    Replies
    1. Hi priyanka ! when you install setup file then change your drive path instead of c drive then it will work definitely. because Your windows file denied this installation .

      Delete
  54. hi ramashanker ! as you suggest i do setup of my project but in configuration i set value of variable and when i execute application then value is display.for e.g. if value is set like c = 1 and second time it display c=1.1 and third time c=1.1.1 and so on so how to solve it because value is assign to config variable
    please reply fast.

    ReplyDelete
  55. hi ramashankar ! as you suggest i completed my setup and its wok but problem is that my config variable value can not clear after closing application and next time value of that will display again with new value so please say that how i can clear value of config file variable at the time of close application

    please reply fast

    ReplyDelete
    Replies
    1. hi priyanka ! In your page load initialize variable c =0 ; so when your application will loaded then your variable value(c) will be initialized zero.It will work definitely....

      Delete
  56. hi Ramashanker ! in my application i was create some RDLC report and set path like this.......

    reportViewer1.LocalReport.ReportPath = Application.StartupPath + "\\Reports\\BillReports\\PurchaseOrderBillFormat.rdlc";

    but it doesn't work . can you suggest any thing else for report path.

    thanx for reply

    ReplyDelete
  57. hi Ramashanker ! In my application i was generate report and set path to that report viewer like following but it doesnot work can you say onther way of assign path to report......

    reportViewer1.LocalReport.ReportPath = Application.StartupPath + "\\Reports\\BillReports\\PurchaseOrderBillFormat.rdlc";

    OR

    reportViewer1.LocalReport.ReportPath = Application.ExecutablePath + "\\Reports\\BillReports\\PurchaseOrderBillFormat.rdlc";

    ReplyDelete
  58. Hello Sir,
    I have created EXE setup file of my project and i have given my database connection string in app config file it runs on my machine but when i am trying to run this setup file on another machine that time it given connection error.
    So how can i solve this ?

    ReplyDelete
  59. Hello Sir,
    I have created EXE setup file of my project and i have given my database connection string in app config file it runs on my machine but when i am trying to run this setup file on another machine that time it given connection error.
    So how can i solve this ?

    ReplyDelete
  60. your app config code will be different for other computer, first find data source name for other computer and put them with your connection string codes.After that create setup file.
    if you want to no changes in connection string code then follow below link:
    http://www.msdotnet.co.in/2013/07/how-to-create-setup-fileexe-with.html

    ReplyDelete
  61. your app config code will be different for other computer, first find data source name for other computer and put them with your connection string codes.After that create setup file.
    if you want to no changes in connection string code then follow below link:
    http://www.msdotnet.co.in/2013/07/how-to-create-setup-fileexe-with.html

    ReplyDelete
  62. Hello Sir,

    I want to create a exe which will be execute only 1 time or execute only 1 pc can you help me????

    ReplyDelete
  63. How can we modify the setup for applications including a crystal report?

    ReplyDelete
  64. I have created setup file as per above steps but errors occurs like Error 2 Unable to find source file 'D:\IT-DEPT\SBill - Copy\SBill\mysetup\stdole.dll' for assembly 'stdole.dll', located in '[TARGETDIR]'

    ReplyDelete
  65. how to prevent the program to install in the default directory 'C:\Program Files'

    ReplyDelete
    Replies
    1. you can choose different directory (instead on C:\Program files) path when you are installing this setup file on your computer...

      Delete
  66. I can not able to add icon in my project. Although the icon is added in User desktop or in Application folder. But it could not add with the property of shortcut. Please help me how to fix the icon in my setup file.

    ReplyDelete
  67. please friend i m createing a window form in asp.net but i don't know how i connect to oracle database to asp.net how i connect and whats a codding to connnection to asp.net please tell me any body who know about this plz help me...

    ReplyDelete
  68. I am creating setup in visual studio 2012 with sql server database 2012 and SAP crystal report also.
    I run setup on xp sp3 but i got error Application error what am i do

    than which software are install before run a setup on client computer

    ReplyDelete
  69. I am creating setup in visual studio 2012 with sql server database 2012 and SAP crystal report also.
    I run setup on xp sp3 but i got error Application error what am i do

    than which software are install before run a setup on client computer

    ReplyDelete
  70. I am creating Setup (Windows Application) in visual studio 2012 with sql server database 2012 and SAP crystal report also
    1)before i run setup which software are install on client computer
    2) i run setup on client pc i got error Application error
    What am i do

    ReplyDelete
  71. Thank you Sir....
    I understand to create setup file from this.
    Its working well.

    ReplyDelete
  72. sir i create a winform with sql server database and create a setup file as you teach but when installing on another system it gives error sql server express not found on system what wil i do plzzzzzzzzzz

    ReplyDelete
    Replies
    1. Hi GHS JANGLA,
      You can install sql database on that computer also and create same table name and column name as given in your setup file.otherwise you have to create setup file from below link..
      http://www.msdotnet.co.in/2013/07/how-to-create-setup-fileexe-with.html

      Delete
  73. Hi I just want to execute an exe file using windows application ,I jus need an procedure frm first

    ReplyDelete
  74. hi ramashankar ! as you suggest i completed my setup and its not working but problem my system is visualstudio and sql server not installed,
    please reply fast

    ReplyDelete
  75. Thank you very much for this tutorial.

    ReplyDelete
  76. I create a setup file and its shorcut user'desktop file for my apps but after installation when i run my apps from shortcut it's give an error " operation must use an updateable query."But when i run my apps as administrator then its works correctly.
    So plss give me suggestion how to provide write access on db for shortcut desktop's file so that we need not run my program as administrator.

    ReplyDelete
    Replies
    1. Hi sandhya,
      There may be following problems,read below link
      https://support.microsoft.com/en-in/kb/175168
      http://forums.asp.net/t/154273.aspx?FIX+Operation+must+use+an+updateable+query+error+when+using+Access+db

      Delete
  77. Hello...sir.. I am Ajinkya Mate.. i have created set up file.. but after executing this set up file in another system it work properly but CRYSTAL REPORTS are not open.. it gives me error unable to open file

    ReplyDelete
  78. I am unable to see the images.!!

    ReplyDelete
  79. but that install on another machine it show error object reference how to handle that

    ReplyDelete
  80. i have created application and a table is attached with it with the help of search box i cand find details of any user. i want to an exe file please help ..

    ReplyDelete
  81. hello there,
    I'm Nadeem i'm looking to create setup file for my setting wizard to take information regarding company which will use & the wizard is also part of project. In Short i like to create custom page setup first then like to execute my application setup. would you guide me to do so how can i ?

    ReplyDelete
  82. we done a project in vs2010 and sql2008r2 database. after converting to .exe file and installed in another pc..it dosen't work eventhough we have sql in that pc

    ReplyDelete
  83. Hello Sir,
    I have created EXE setup file of my project and i have given my database connection string in app config file it runs on my machine but when i am trying to run this setup file on another machine that time it given an error "unhanded exception has occurred in your application if u click continue the application will ignore this error and attempt to continue".
    So how can i solve this ?

    ReplyDelete
  84. Hello Sir,

    Icon is not showing on desktop on below step

    Go right side window-> Right mouse click ->Add file->select icon file (extension . icon) , This icon will show on Your desktop when you install the setup on computer.

    Thanks,
    Garima

    ReplyDelete
  85. Hi garima,
    You have to follow each step carefully.then when you will install your setup file ,icon will be showed on your desktop.otherwise you can download whole project file from below and see

    ReplyDelete
  86. Thanks you Sir,
    Help me a lot :)

    ReplyDelete
  87. I have recently installed VB 2017 on my system does the procedure remains the same?
    Please Help sir,
    Regards,
    Shivansh

    ReplyDelete
  88. Hi I am Naveen,
    I am created setup file for my project using your setup creation process finally .EXE file also created,but i will try to install exe file at the time following error message has been showed, please help me to solve this issue:
    Error reading from file: E:\test\setup\Debug\setup.msi. verify that the file exists and that you can access it.

    ReplyDelete
  89. I have made a windows application using Visual Studio 2015 with database integration using SQL Server Management Studio 2014. I wanted it to be deployed on some other machine for that purpose, I have made the .exe file but when I install the .exe file on the client's machine it shows a connection error, I know why this happens because the clients machine doesn't have SQL server and I have used connection string in the project according to my SQL server and set the path according to my machine. I just wanted to know is there any way that I can get a .exe file that no needs external SQL Server for database and it should reside inside the application as client installs it and ready to go without any need of SQL Server separately.

    ReplyDelete

  90. Nice article and explanation Keep continuing to write an article like this you may also check my website
    Advanced Installer crack

    ReplyDelete

Powered by Blogger.