Breaking

Search Here

21 November 2014

SetUp Path for window application


Introduction: 

Here I will explain how to create setup file for windows form application in visual studio 2008 in c# with example. To create setup file windows application in c# we need to use setup and deployment section templates in visual studio.

Description:
  
In previous articles I explained constructors in c# with examples, difference between virtual, override, new keywords in c#, Difference between sessionstate and viewstate, Highlight gridview rows on mouseover in jQuery and many articles relating to asp.net, c#,vb.net and JQuery. Now I will explain how to create setup file for windows form application in visual studio 2008 in c# with example.

Before we create setup file for windows form application first we will create one sample windows forms application

Go to File à project à select Windows Forms Application à Give name to your application à click OK like as shown below


Now in your page add Textbox and button controls and double click on your button and write the code like as shown below

private void button1_Click(object sender, EventArgs e)
{
string str = textBox1.Text.Trim();
if(str!="")
{
MessageBox.Show("Thank You For Interest", "Success");
}
else
{
MessageBox.Show("Please Enter Name", "error");
}
}

Once you write the code run your application that will return the output like as shown below

Now we have sample windows form application for this we will create setup file.

First close your application and again open visual studio and create new setup project by following below steps

Go to File à Project à Other Project Types à Select Setup and Deployment à Select Setup project like as shown in below image

It will open window like as shown below in which contains three folders those are Application Folder, User’s Desktop and Users’ Program Menu. These folders are the places where we want to copy our setup files during installation process. Now right click on Application folder and select Add à File like as shown below

Once we click on File it will open new window in that navigate to bin folder of your sample windows form application and select your application .exe file and click OK like as shown below

Once we add exe file now right click on your setup file and click on create shortcut to add that shortcut to User’s Desktop folder or User’s Program menu when you install the application

Now right click on your setup project like as shown below to change properties

In properties window click on Prerequisites button to add required changes like .NET framework, SQL Server Compact to setup file like as shown below

Once you done all the changes now right click on your setup project and click Build it will create setup file in your setup application folder like as shown below

Now open your setup files application folder and check it in debug folder it will contains setup files like as shown below 

Now click on your setup file to install it. If you click on setup file it will open window like as shown below

Now click Next Next in windows it will install your application like as shown below

Once installation completed it will create shortcut on desktop because we added a properties to create shortcut on desktop if you open it will be like this

I hope it helps you to create setup file for your windows form application















No comments:

Post a Comment

Hello all, if you have any doubt feel free comment

Comments