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.
Create a simple add calculator for demo purpose.
Form1.cs
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace MyCalculator
- {
- public partial class Form1: Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void btnAdd_Click(object sender, EventArgs e)
- {
- int firstNumber = 0;
- int secondNumber = 0;
- if (string.IsNullOrEmpty(txtFirstNumber.Text))
- {
- MessageBox.Show("Enter First Number");
- }
- else
- {
- firstNumber = Convert.ToInt32(txtFirstNumber.Text);
- }
- if (string.IsNullOrEmpty(txtSecondNumber.Text))
- {
- MessageBox.Show("Enter Second Number");
- }
- else
- {
- secondNumber = Convert.ToInt32(txtSecondNumber.Text);
- }
- int result = firstNumber + secondNumber;
- lblResult.Text = "Result is " + result.ToString();
- lblResult.ForeColor = System.Drawing.Color.Red;
- }
- }
- }
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.
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.
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.
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.
It will ask to activate your InstallShield Limited Edition Project. So, open your email where you have just received an email with serial number.
Put your serial number here and click to
Activate.
It will take few minutes to install and configure the setup project for you.
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.
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.
You can also provide the icon for the setup file. Just browse your icon file as in the following and press
OK.
Inside the
Installation Requirement icon, you can choose different types of operating system and additional tools which might be required for your project.
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. 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.
It will add your project as a primary output.
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.
You can browse your destination file from the
ProgramFilesFolder. Double click on
ProgramFilesFolder.
A new folder will appear which relates to your company name which you have provided in the
Application Information field.
Select your primary output file and open it.
It will automatically add the
Application Shortcuts section with “
built” name.
Here you can also rename the name of the setup file as
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.
Click to next icon
Application registry, here you can add the system registry.
The last step is
Installation Interview icon; you can provide some extra setup information.
Now go to the
Solution Explorer and open you setup project. You can see the Components which is appeared below.
Inside the
General Information section you can see all the information of your setup file.
Here, you can edit the message inside the 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.
If you want to create only one setup file without some extra file, then go to
Build menu and choose
Configuration Manager.
From here you can choose your project and from the configuration section select “
SingleImage option”.
You can also change the type of the project like
debug, release, etc. Now once again run the rebuild option and go to setup location, you can see there is only one setup file created.
Now double click on
setup.exe to run the setup.
Here is welcome message from the Add Calculator setup wizard. Click
Next.
Choose License Agreement and click
Next.
You can change the location of the installation directory and click
Next.
Now setup is going to ready for installation, so click on
Next.
It will take few minutes to install the tool.
And finally you will get the successfully completed message and so click “
Finish” Button.
When you go to your desktop you can find the
My Calculator icon over there.
Click on this to run the tool, it will open the tool which you have created earlier.
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.