Поделиться через


Walkthrough: Deploying Your Program (C++)

Now that we've created our application, the last step is to create an installer that other users can use to install the program on their computer. To do this, we'll add a new project to our existing solution. The output of this new project is a setup.exe file that will install the application that we've previously created on another machine.

Note

The information in this topic does not apply to Visual C++ Express Edition.

This walkthrough uses Windows Installer for deploying your application. You can also use ClickOnce to deploy an application. For more information, see ClickOnce Deployment for Visual C++ Applications. For more information on deployment in general, see Deploying Applications and Components.

Prerequisites

This topic assumes that you understand the fundamentals of the C++ language.

The features used in this procedure are not available in Visual C++ Express.

To create a setup project and install your program

  1. From the File menu, click New, and then click Project.

    The Add New Project dialog box appears.

  2. Under Installed Templates, expand the Other Project Types node. Next, expand the Setup and Deployment node and click Visual Studio Installer.

  3. From the Templates pane, select Setup Wizard. Type a name for the setup project, such as gameInstaller. In the Solution listbox, select Add to Solution. Click the OK button.

  4. The Setup Wizard will appear. Click Next to continue.

  5. From the Choose a project type pane of the wizard, select the Create a setup for a Windows application option and click Next to continue.

  6. From the Choose project outputs to include pane of the wizard, select Primary Output from game, and click Next to continue.

  7. We do not need to include any additional files in our installer, so from the Choose files to include pane of the installer, click Next.

  8. Review the changes from the wizard, and verify that everything is correct. Click Finish to create the project.

    The new gameInstaller project will be listed in the Solution Explorer. This project will list the dependencies that your application depends on (such as the C Runtime Library or the .NET Framework) as well as the project files that are to be included in the installer.

    There are many options that can be changed after the setup project has been created. For more information, see Visual Studio Installer Deployment.

  9. Build the installer by selecting it in the Solution Explorer and clicking Build gameInstaller from the Build menu.

  10. Locate the setup.exe and gameInstaller.msi programs created by the previous section. Double click on either file to install the application on a computer.

Next Steps

Previous: Walkthrough: Debugging a Project (C++) | Next: Creating Command-Line Applications (C++)

See Also

Tasks

Visual C++ Guided Tour

Other Resources

Deployment (Visual C++)