Friday, 27 November 2015

How To Create Setup File(.Exe File) From Windows Forms Application

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 Clickdownload. 
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:-