Self-extracting way to create VC + + program Packaging

Source: Internet
Author: User
Tags microsoft website

Walkthrough:deploying a Visual C + + application by Using the Visual C + + redistributable Package Visual Studio

This step-by-step article describes how to use the Visual C + + redistributable package to deploy a Visual C + + application.

Prerequisites

You must there are these components to complete this walkthrough:

    • A computer that has Visual Studio installed.

    • An additional computer, does not having the Visual C + + libraries.

To use the Visual C + + redistributable package to deploy an application
  1. Create and build an MFC application by following the first three steps in Walkthrough:deploying a Visual C + + application by Using a Setup Project.

  2. Create a file, name it Setup.bat, and add the following commands to it. Change mymfcapplication to the name of your project.

                @echo Offvcredist_x86.exemkdir "C:\Program files\mymfcapplication" copy MyMFCApplication.exe "C:\Program files\ Mymfcapplication "
  3. Create a self-extracting setup file:

    1. At a command prompt or in the Run window, run Iexpress.exe.

    2. Select Create New self Extraction Directive file and then choose the Next button.

    3. Select Extract files and run an installation command and then choose Next.

    4. In the text box, enter the name of your MFC application and then choose Next.

    5. On the confirmation prompt page, select No. prompt and then choose Next.

    6. On the License agreement page, select Don't display a License and then choose Next.

    7. On the Packaged files page, add the following files and then choose Next.

      • Your MFC application (. exe file).

      • Vcredist_x86.exe. This file was located in \program Files\Microsoft Sdks\windows\v7.0a\bootstrapper\packages\vcredist_x86\.

      • The Setup.bat file, created in the earlier step.

    8. On the Launch page, the " Install Program" text box, enter the following command line And then choose Next.

      Cmd.exe/c "Setup.bat"

    9. On the Show window page, select Default and then choose Next.

    10. On the finished message page, select No message and then choose Next.

    11. On the package name and Options page, enter a name for your self-extracting setup file, select the Store F Iles using a Long File Name inside package option, and then choose Next. The end of the file name must be setup.exe-for example, MyMFCApplicationSetup.exe.

    12. On the Configure restart page, select No. Restart and then choose Next.

    13. On the save Self Extraction Directive page, select Save self Extraction Directive (SED) file and then CH Oose Next.

    14. On the Create Package page, choose Next.

  4. Test the self-extracting setup file on the other computer, which does not having the Visual C + + libraries:

    1. On the other computer, download a copy of the setup file, and then install it by running it and following the steps that I T provides.

    2. Run the MFC application.

      The self-extracting setup file installs the MFC application that's in the folder so specified in step 2. The application runs successfully because the Visual C + + Redistributable Package installer are included in the Self-extract ing setup file.

      Important

      To determine which version of the runtime is installed, the installer checks the registry key \hklm\software\microsoft\vis Ualstudio\11.0\vc\runtimes\[platform]. If the currently installed version is newer than the version and the installer are attempting to install, the installer re Turns success without installing the older version and leaves an additional entry on the installed Programs page in the Co Ntrol Panel.

      Redistributing Visual C + + FilesVisual StudioOther Versions

      When you deploy a application, you must also deploy the files that is required to support it. If any of these files is provided by Microsoft, check whether is permitted to redistribute them. To review the Microsoft software License Terms, see license.htm in the directory where Visual Studio was installed, or on t He Visual Studio installation media. To view the "REDIST list" which is referenced in the "distributable Code" section of the Microsoft software License Terms F or certain editions of Visual Studio, see Distributable Code for Microsoft Visual Studio and Microsoft Visual Studio SDK on the Microsoft website. For more information on redistributable files, see Determining which DLLs to redistribute and Deployment Examples.

      To deploy redistributable Visual C + + files, you can use the Visual C + + redistributable Packages (Vcredist_x86.exe, Vcre Dist_x64.exe, or Vcredist_arm.exe) that is included in Visual Studio. These files can be found under your Visual Studio installation directory in program files [(x86)]\microsoft Visual studio& nbsp version \vc\redist\ locale \. Another option is to use redistributable merge modules (. msm files), which can be found in program files [(x86)]\common Fi Les\merge modules\. It ' s also possible to directly install redistributable Visual C + + DLLs in the  application local folder , whic H is the folder that contains your executable application file. For servicing reasons, we don't recommend that and this installation location.

      The

      The Visual C + + redistributable Packages install and register all Visual C + + libraries. If You use one, you must set it-to-run on the target system as a prerequisite to the installation of your application. We recommend that's these packages for your deployments because they enable automatic updating of the Visual C + + Lib Raries. For an example on how to use these packages, see walkthrough:deploying a Visual C + + application by Using the Visu Al C + + redistributable package.

      Each Visual C + + Redistributable Package checks for the existence of a more recent version on the machine. If A more recent version was found, the package was not installed. Starting in Visual Studio, redistributable packages display a error message stating that Setup failed. If A package is the run by using the  /quiet  flag, the no error message is displayed. In either case, an error was logged by the Microsoft installer, and an error result was returned to the caller. Starting in Visual Studio packages, you can check a registry value to find out if a more recent version is installed. The currently installed version is stored as a REG_SZ value in the version key in Hkey_local_machine\software[\wow6432nod E]\microsoft\devdiv\vc\servicing\14.0\runtimeminimum. You don ' t need to install your redistributable package if the currently installed version are more recent.

      If You use a merge module that contains a Visual C + + DLL, you must include it in the Windows Installer package (or similar installation package) That's the using to deploy the application. For more information, see Redistributing the components by Using the Merge Modules. For the example, see Walkthrough:deploying a Visual C + + application by Using a Setup Project, which also shows InstallShield Limited Edition to create a installation package.

      Potential Run-time Errors

      If a Visual C + + library DLL is not reachable and Windows cannot load it for your application, this message could be Displaye D: This application have failed to start because Msvcr<version Number>.dll is not found. Re-installing the application may fix this problem.

      To resolve this kind of the error, make sure that your application builds correctly and that Visual C + + libraries is correctl Y deployed on the target system. For more information, see Understanding the Dependencies of a Visual C + + application.

      related Topics

      Title

      Description

      Redistributing components by Using the Merge Modules

      Describes how to use Visual C + + Redistributable merge modules to install the Visual C + + runtime libraries as shared DLLs I n the%windir%\system32\ folder.

      Redistributing Visual C + + ActiveX Controls

      Describes how to redistribute a application that uses ActiveX Controls.

      Redistributing Database Support Files

      Discusses how to redistribute support files for Data Access Objects (DAO) and the database technologies in the Microsoft D ATA Access SDK.

      Redistributing the MFC Library

      Describes how to redistribute a application that uses MFC.

      Redistributing an ATL application

      Describes how to redistribute a application that uses ATL. Starting in Visual Studio, no redistributable library for ATL is required.

      Deployment Examples

      Links to examples this demonstrate how to deploy Visual C + + applications.

      Deploying Native Desktop Applications (Visual C + +)

      Introduces Visual C + + deployment concepts and technologies.

Self-extracting way to create VC + + program Packaging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.