Creating a setup file in VC++


Ever imagined how the setup files are made? i was curious too. Following is the procedure to create one in Visual Studio for VC++ projects.

Creating a setup file for your application using MS Visual Studio 2008

1. First build your application & generate the executable (.exe) file in “Release mode”.

2. While the solution file is still open in VS, create a deployment project (as shown in the fig 1):

File> New Project > Project types: select “Setup & Deployment”.

fig 1

3. On the Templates pane on right side, select “Setup Project”. Give a suitable name & location for the project.

4. Instead of “creating a new solution”, select the “Add to solution” option from the drop down list. The window will look like this:

fig 2

5. Add the output of the application project to the setup project. To do so, right-click on Setup1 in Solution Explorer, point to Add, and then click Project Output… fig 3.fig 3

i. In the Add Project Output Group dialog box, select Primary Output.

ii. Select Release Win32 from the Configuration drop-down box, and then click OK.

6. In the Detected Dependencies, Visual Studio adds the dependent merge module (.msm) files for the Visual C++ libraries to the setup project.

fig 4

7. IMP: if you have any other dll or lib files that your project depends on, add it to the Application folder by right clicking “Application folder” in the “File System” tab & Add > file.

fig 5 fig 6

8. Build the setup project to create the installer files (Setup1.msi and setup.exe). To do so, right click the Setup1 project node in Solution Explorer and select Build.

Visual Studio creates the installer files in the Release folder of your setup project.

fig 7

9. Run the installer on a second computer that does not have the Visual C++ libraries.

i. Copy Setup1.msi and setup.exe to the second computer.

ii. Run setup.exe on the second computer. Follow the steps that are provided by the setup wizard to complete the installation.

fig 8 fig 9

Go to the installation folder & run the .exe. It should produce the desired output.

Reference: MSDN Library

Advertisements

3 responses to “Creating a setup file in VC++

  1. Awesome guide to create a setup file.
    Thank you so much.
    I have one doubt is you can help.
    I have some pdf files that are supposed to open on button clicks.
    I want to know how can i set their path for creating setup files like relative path.
    Its working with absolute path but not with the relative one.
    I will be thankful is you can help.

    • Hi Neha, this creation of a setup file I had tried just out of curiosity. I have stopped working in this area since a long time. You can get your question answered in proper MS forums.

  2. Thnx for this explanation. But I have a confusion, if my setup creates some files like logs.txt they are not removed during uninstall. What can I do in such a situation ??

What do you think??

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s