Create EXE or Setup File in .NET Windows Application

Hi .NET Architects!

Visual Studio 2005 Setup and deployment Projects provides to make an exe or installer file in .NET windows application is easy and rapidly.

Visual Studio provides templates for four types of deployment projects: Merge Module Project, Setup Project, Web Setup Project, and Cab Project. In addition, a Setup wizard is provided to help step you through the process of creating deployment projects. You can see the templates and the wizard in the New Project dialog box under the Setup and Deployment Projects node.

The following are guidelines for choosing the right type of deployment project for your project.

1)Merge Module Project : Packages components that might be shared by multiple applications.

2)Setup Project : Builds an installer for a Windows-based application.

3)Web Setup Project : Builds an installer for a Web application.

4)Cab Project : Creates a cabinet file for downloading to a legacy Web browser.

5)Smart Device Cab Project : Creates a Cab project to deploy device applications.

This topic demonstrates deployment using a Setup and Deployment Project.

Setup Projects

Setup projects allow you to create installers in order to distribute an application. The resulting Windows Installer (.msi) file contains the application, any dependent files, information about the application such as registry entries, and instructions for installation. When the .msi file is distributed and run on another computer, you can be assured that everything necessary for installation is included; if for any reason the installation fails (for example, the target computer does not have the required operating system version), the installation will be rolled back and the computer returned to its pre-installation state.

The following steps will gives the elegant guidance to create an exe or installer file.

1, Go to file menu > click Add > new project >now “Add New Project” dialog will appear.

2.Select the “Other Project Types” and click “Setup and Deployment” projects,Choose “Setup Project”give name project name in name text box finally click OK.

3.New project appear in solution explorer,for eg., you have give the name “MyEXE” file will be displays with given name.

4.Right click the MyEXE > go View > click “File System”

5.You can see the “File System on TargetMachine”under  three folders
Application Folder
User’s Desktop
User’s Program Menu

6.Select Application Folder and right click Add>Project Output>select Primary output

7. Select User’s Desktop richt click on the second window>click create new shortcut>select output file from Application folder>change the file name from  primary output name to MyEXE

next >>

same procedure follows the user’s program menu also

8.If you want to change the Manufactures name for exe,just right click the project go to properties

change the properties as per you requirement

9.Finally Build the new project After successfully Build the project myEXE(Setup) will be appear in Application Debug or Release folder(depend upon the properties settings)

EXE or installer will be available on his physical path…

When you want to install  the EXE on the client machine,you should be installed .NET Framework on that machine because, Applications and controls written for the .NET Framework v2.0 requires the .NET Framework Redistributable Package version 2.0 to be installed on the computer where the application or control runs.

you can get it from here

96 Responses to “Create EXE or Setup File in .NET Windows Application”

  1. Pratap557 Says:

    Thanks a lot. It helped me.
    How to add .net framework2.0 within package. Pls help.

    Thanking you in appreciation

    Pratap557

  2. Shobha Says:

    Hi
    Thanks. It helped me a lot.

    How can make my exe application to create a shortcut or icon on tray?

    Please help me

    Thanks
    Shobha

  3. Kailash Dhondiyal Says:

    Thanx a lot dear. It’s easy to use and implement now i can explore it.
    Thanx and Regards
    Kailash Dhondiyal

  4. wongloon Says:

    It’s so easy to implement it. u r a genius.

    Thanks
    wongloon

  5. senthu Says:

    How to use this procedure If i using COM component

  6. Satveer Singh Says:

    Hi,

    A very Good way of expressing , that How we create the exe file in Windows Application ….

    So,
    Very Special Thank to ur Team….

    Bye ! ! ! ! !

  7. Satveer Singh Says:

    Wanna some useful tips for gridview , I have bind the data but wanted some professional look and also some Images will display And address in taken from the database so how could i do this ..??

    For better Formates and looks of datagrid ..?

    Also wanted to know how to use Paging in DataTable
    if i bound tha data with DataTable control in asp .net page…..

  8. sonu Says:

    how to validate installation with product key

  9. sunil Says:

    nice explanation

  10. Ashwani Says:

    Thanks dear,
    it helps a lot really.

  11. Deepak Kumar Says:

    Dear sir,
    Thank you for the useful Information. Please tell me how can i create Setup file if my apllication contains Database file. I connected my database through Sql Server. Please help me. i also created dataset in my project.

    Thanking you,

  12. Amit Sharma Says:

    thanks a lot.
    It has helped me to do my work much better.

    Amit Sharma

  13. Manoj Kumar Says:

    Hi,
    First of all thanks to the wonderful post.
    Got some doubts, How to include Microsoft SQL Server 2005 in this setup?? Also i need to include crystal reports also…

    Would be great if u help me out…

  14. Shanmugam Says:

    It is very useful thread

  15. Rajeev Kumar Says:

    It very useful for software developer. Thanks a lot for this article.
    Rajeev
    Software Application Engineer
    http://www.tech-soigne.com

  16. edwin Says:

    hi…
    thanks for the article …

    I need some help…

    My project is with VS2005, SQL SERVER 2005.. and crystal report too..

    How can i add these into the setup files…

    a quick reply will avoid my trouble..

    I already developed the project … What should I do to install my application to the client machine which has only windows OS installed..

    this is my first project … please provide me a solution from the base…

    Thank you

    regards
    edwin

  17. Uzair Aziz Says:

    Hello..
    First of all i want to say thank you for giving such a nice and step by step article.Now i can create EXE with the help of your article ,you made it very simple now.

    Thanking & Regards,
    Uzair Aziz

  18. Nandu Says:

    thank u very much , for Setup steps

  19. Bakiya Says:

    Thanks a lot. It helped me a lot.
    How to add .net framework2.0 within package. Pls help.

  20. Ravindra Says:

    Thanks…… it’s i very Useful for me…………

  21. Jayabharathi Says:

    Thanks. Thanks a lot.
    This article helps me to create setup file easily.
    And also i want this article, to create the setup file with register key. It wil be more helpful for me. Thank u.

  22. Deepa Says:

    Thanks. Thanks a lot.
    This article helps me to create setup file easily.
    And also i want this article, to create the setup file with register key. It wil be more helpful for me. Thank u.

  23. Harish Thakkannavar Says:

    Good for the experts but not so nice for the begineers

  24. Bengate Anierobi Says:

    Good publication, thanx Dude

  25. Shrawan Says:

    It was realy helpful for me…i am begineer inC# .NET so plss tell me how to change the icon created after installation……
    thanks & regards
    shrawan

  26. Zahra Karimi Says:

    Hi
    Thanks for your document.
    I want to merge an exe file(it is a patch of crystal report) to my installation.
    When i add it as a file, it is not merged.
    Also i am having that mentioned problem, about sql server 2000
    Is it necessary to install client connectivity of sql server in client.
    I am using .net1.1
    Thanks

  27. praba Says:

    hi,
    Though i know it, your way of explaining was really good…congratessssssssss………….

  28. Harshad Says:

    Thanks Explore.net
    Thanks for giving me an right steps of creating an exe
    thats really help me

  29. Haja Says:

    Very thanks.

  30. Haja Says:

    Way of explanation is good

  31. Datta Kale Says:

    hi

    thanx for you yr docs .it is gr8 .but i want to set application installation path

    how can i do it ???

    thnx in advance .

  32. karthika Says:

    hi,
    Thanks a lot my dear friend…

    and i have a doubut,how to add image(i.e icon) to our setup/exe ,it disply in desktop as notpad file.

    pls help me pa..

  33. shivaram Says:

    @karthika
    you will have to add the ico file from the exe properties. find the property ico and add the ico from the windows path.

    question:
    how to add .net framework 2.0 with the installer ??????? i think here no one has answer…..
    Thanks

  34. sitaramrajput Says:

    hi,
    guys, when I create a setup file , Databae is not inbuild in it. I am looking any tell me me how database can inbuild within setup so I need not to paste it program directory and increase security of database.

  35. sitaramrajput Says:

    need a quick response please. My project is under process.

  36. sylvester Says:

    man superb….thnks a lot……It’s so easy….

  37. Hamza Says:

    Please describe how to link database in this setup project
    with sqlserver 2005
    thank you
    where is place DB in folder project .?
    I add data base as Microsfot SQL SERVER DATABASE FILE

  38. vimal Says:

    hi ,
    thanks a lot my dear!!

  39. Tejash Says:

    thanks a lot

  40. priya Says:

    Hi ,

    i m using Visual studio 2005 version in that i dont have this option…to convert exe file please help me to convert….

  41. Selami Ozlu Says:

    Hi All,
    is there any way to create a setup for both web based abd windows application?
    For example I have a project created in VB in windows and 2 VB.NET in web projects. I want to create a setup project which will combine these 3 projects.
    Thank you in advance,
    Selami Ozlu.

  42. DensS cessario Says:

    Dude, Thanks for the tips. There’s no way I forgot to thanked an article like this! Woot~

  43. Vishnu Says:

    yo buddy, really it helps me a lot… thank you very much…
    its coolll….

  44. Ahmed Omer Says:

    Hi,
    I am using visual studio 2003 C# ,I want to make setup for
    web application using SQL 2000 DB and crystal report what the step for setup and necessary files to install in client machine?
    Please help me.

  45. haritha Says:

    thanks a lot…!! it help us very much

  46. horace trever Says:

    Great thanks balanagaraj !

  47. shyam Says:

    hai
    thank you very much
    it really helps me a lot
    am studying mca…and tomorrow is my review..
    you helped me a lot thank you friend…
    thanks,,,,

  48. rew2019 Says:

    Nice article…

  49. Sameer Says:

    Thank you for the useful Information. Please tell me how can i create Setup file if my apllication contains Database file. I connected my database through Sql Server 2005. Please help me

  50. Alamdari.Ali Says:

    thank you for your help, that is very nice article

  51. utku Says:

    hi…I already created the exe file but since my database is not included I can’t use the application…how can I include the db into the setup file??

  52. mithun Says:

    you are great …
    i was worred about the my .exe file
    thanx a lot

  53. vaibhav Says:

    i can create the .exe and also i can setup it but i can not see the setuped program in my system ot other system it is being not working any setup as illustrated in yr site . please guide me how to work on it .

  54. FausCuba Says:

    Thanks a lot, this is a big doubt that I had and your explanition make resolve it, good How To…

  55. jagadesh Says:

    Thz a lot. It helps me more.

  56. Random T. Says:

    If you ever want to see a reader’s feedback :) , I rate this post for four from five. Detailed info, but I have to go to that damn google to find the missed parts. Thank you, anyway!

  57. Narsingh Tomar Says:

    Thanx a lot dear. It’s easy to use and implement now i can explore it…………………………

  58. Lokesh Kumar Says:

    Nice, buddy. You have done a great job. I am doing my mca 6th semester trainings and i was searching for the answer which u have just narrated so efficiently.
    Thanks a lot.

  59. kube Says:

    thnx the article was useful.

  60. dianikol Says:

    i have an app with a db..mdf included . i just did your steps. but when i run it ,it says

    “An attempt to attach an auto-named database for file C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be Opened, or it is located on UNC share.”

    what i shou do??

    thanks you

  61. Abhishek Says:

    Thank you very much for your effort. Excellent article

  62. neeraj Says:

    how to change connection string into EXE file when we installed exe onto client mechine i m using sqlserver2000 for database my project in Vs2005

    my project is completed please help as soon as possible
    how to change connnection string ?

    thanks
    neeraj

    • Priyanka Says:

      Thanks,
      it helps a lot really.

      Is it possible to make setup file for Mac Operating System. So that i could run my application there also.

  63. dianikol Says:

    try this string but with wql express, its not big deal

    Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\myDatabase.mdf;Integrated Security=True;User Instance=True

  64. ASWIN Says:

    Thanks a lot.. great work

    (“…”)

  65. priyanka Says:

    Hello…

    When i install this newly created set.exe file, after installation application doesn’t start automatically. I have to start it manually. Is there any way to auto start the application after installation.

    Thanks,
    Priyanka

  66. Samir Says:

    hii, can u tell me which files are necessary to be attached alongwith the application, so that it runs on the client PC. my windows app has database files (.mdf). So which files should i attach and how..?
    pls help..!

  67. trupti Says:

    Myapp.exe.config file is created during installing setup?
    how to remove it?

  68. rahul Says:

    thax a lot frnd.
    it helped me lot ….

  69. Anish Says:

    thanks for that i am very happy

  70. Raj Says:

    its great….working fine….thanks a lot friend….u r jenius…….

  71. Anil Kumar Podile Says:

    HI sir
    Really This Concept Is Enough To Build A Set UP File.,but Add one Good Example With is the Good Example.please attach one Example.

  72. Joby Says:

    thanks….
    this is very helpful for me….

  73. tejas Says:

    A Very BIG THANX !!!!!!!!!!!!!!!!

  74. tejas Says:

    i was able to make a setup file

    Thank you

    the steps are easy to follow, thanks

  75. DEEPAK K M Says:

    thanks we got help from this blog….
    friends these steps are really working…..

    THANKS A LOT….

  76. manoj Says:

    Thanks a lot.

    for making it easy.. it helps a lot.

  77. Anjana Says:

    Thank you very much…….. You are my hero of the day sir.

  78. Pardha Says:

    Thank you very much….. This article helped me alot

  79. karan johar Says:

    LOVE KARAV MATE SHU KARAVU JOVE>>>>TE JANAVO>>>

  80. s_a_2002 Says:

    Hello,
    Very useful post,Thanks

    I don’t have the setup template, how can I get the template? can find it on net!

    Thanks

  81. Kaustubh Says:

    Hats off 2 u

    Thanks dude!!!!

    Its very useful


Leave a Reply