Creating Setup File With Visual Studio 2013

Firstly, I am going to create a simple window application “MyCalculator” where we will add simple add functionality. So, to create new Windows application, open Visual Studio 2013 and choose Visual C#, then Windows and from the right pane, you need to choose Windows Forms Application. Provide the simple name “MyCalculator” and click OK.

Windows Forms Application

Create a simple add calculator for demo purpose.

Create a simple add calculator

Form1.cs

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.ComponentModel;  
  4. using System.Data;  
  5. using System.Drawing;  
  6. using System.Linq;  
  7. using System.Text;  
  8. using System.Threading.Tasks;  
  9. using System.Windows.Forms;  
  10. namespace MyCalculator  
  11. {  
  12.     public partial class Form1: Form  
  13.     {  
  14.         public Form1()  
  15.         {  
  16.             InitializeComponent();  
  17.         }  
  18.         private void btnAdd_Click(object sender, EventArgs e)  
  19.         {  
  20.             int firstNumber = 0;  
  21.             int secondNumber = 0;  
  22.             if (string.IsNullOrEmpty(txtFirstNumber.Text))  
  23.             {  
  24.                 MessageBox.Show("Enter First Number");  
  25.             }  
  26.             else  
  27.             {  
  28.                 firstNumber = Convert.ToInt32(txtFirstNumber.Text);  
  29.             }  
  30.             if (string.IsNullOrEmpty(txtSecondNumber.Text))  
  31.             {  
  32.                 MessageBox.Show("Enter Second Number");  
  33.             }  
  34.             else  
  35.             {  
  36.                 secondNumber = Convert.ToInt32(txtSecondNumber.Text);  
  37.             }  
  38.             int result = firstNumber + secondNumber;  
  39.             lblResult.Text = "Result is " + result.ToString();  
  40.             lblResult.ForeColor = System.Drawing.Color.Red;  
  41.         }  
  42.     }  
  43. }  
Now, it is time to add Setup project in the existing solution. Setup project is a separate project where we will add all the required files and details for the setup.

To add new setup project, Right Click on the solution and choose Add, then New Project. It will open an Add New Project window where you can choose your setup project. Go to Other Project Types and choose Setup and Deployment.

From the right pane window, you will see “Enable InstallShield Limited Edition”, you just need to choose it and press OK. Actually with Visual Studio 2013, the setup project is based on your requirement.

Enable InstallShield Limited Edition

When you press OK, it will open InstallShield Limited Edition for Visual Studio page. Here you will find the link as Go to the download web site from where you can enable setup project with your Visual Studio. Click on the Go to the download web site and it will redirect you to some other page.

Go to the download web site

Here you need to register to fill your data with email address and click to Download Now.

It will send you an email to your registered email id with one serial number key which will be required when you will be going to use the setup project.

click to Download Now

When everything will be configured correctly then you don’t need to do anything for Setup Project. Once again go to add new project and this time you will see that InstallShield Limited Project is enabled and ready for use. So, choose the project and provide the name of the setup project and press OK.

setup project and press OK

It will ask to activate your InstallShield Limited Edition Project. So, open your email where you have just received an email with serial number.

serial number

Put your serial number here and click to Activate.

Put your serial number

It will take few minutes to install and configure the setup project for you.

configure the setup

setup project

It will open default window pane “Project Assistant”. This is like a wizard here you can find all the steps to create the setup for your application.

Project Assistant

So, first click on the Application Information icon and here you can add your company and version details for the setup file. You can also mention your company website for the setup with setup icon file.

website for the setup

You can also provide the icon for the setup file. Just browse your icon file as in the following and press OK.

icon for the setup file

Inside the Installation Requirement icon, you can choose different types of operating system and additional tools which might be required for your project.

Installation Requirement

Click on Application Files icon, this is important section where you specify the project as primary output with ProgramFilesFolder. To add your project, click to Add Project Output.

Add Project Output

From the Visual Studio Output Selector window, select your primary output. You can also include any other files which is required to complete the installation like some configuration files, xml files, etc.

select your primary output

It will add your project as a primary output.

add your project

Click on next icon that is Application Shortcuts. Here you can define which component you are going to create installation setup. Click on New for new setup installation process.

New for new setup installation process

You can browse your destination file from the ProgramFilesFolder. Double click on ProgramFilesFolder.

ProgramFilesFolder

A new folder will appear which relates to your company name which you have provided in the Application Information field.

Application Information

Select your primary output file and open it.

Select your primary output file

output file

It will automatically add the Application Shortcuts section with “built” name.

Application Shortcuts

Here you can also rename the name of the setup file as My Calculator from built.

My Calculator from built

There are some options to create setup shortcut icon in start menu, on desktop and you can also provide the “alternative icon” for your setup file.

alternative icon

Click to next icon Application registry, here you can add the system registry.

Application registry

The last step is Installation Interview icon; you can provide some extra setup information.

Installation Interview

Now go to the Solution Explorer and open you setup project. You can see the Components which is appeared below.

solution explorer

Inside the General Information section you can see all the information of your setup file.

General Information

Here, you can edit the message inside the Text and Message section.

Text and Message section

Now rebuild your project and open project location as in the following and inside that you will be finding the setup file with some other files.

finding the setup file

If you want to create only one setup file without some extra file, then go to Build menu and choose Configuration Manager.

Configuration Manager

From here you can choose your project and from the configuration section select “SingleImage option”.

SingleImage option

You can also change the type of the project like debug, release, etc.

release

Now once again run the rebuild option and go to setup location, you can see there is only one setup file created.

setup location

Now double click on setup.exe to run the setup.

run the setup

Here is welcome message from the Add Calculator setup wizard. Click Next.

Add Calculator setup wizard

Choose License Agreement and click Next.

License Agreement

You can change the location of the installation directory and click Next.

change the location

Now setup is going to ready for installation, so click on Next.

setup

It will take few minutes to install the tool.

install the tool

And finally you will get the successfully completed message and so click “Finish” Button.

Finish

When you go to your desktop you can find the My Calculator icon over there.

My Calculator icon

Click on this to run the tool, it will open the tool which you have created earlier.

run the tool

Conclusion

So, today we have to create setup file with Visual Studio 2013 with simple demo example..

Suggest, what do you think

Thanks for reading this article, hope you enjoyed it. Please share your valuable feedback and suggestion through comments.

 

Up Next
    Ebook Download
    View all
    Learn
    View all