Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Visual C++
Deployment
Deployment Examples
 How to: Deploy using XCopy
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual C++
How to: Deploy using XCopy

Updated: October 2008

This topic demonstrates how to deploy applications by copying application files from one computer to another. This technique is useful for debugging applications on another computer. For background on this deployment scenario, see Scenarios for Deployment Examples.

Visual C++ Redistributable Package can be used to deploy release versions of all Visual C++ libraries. These are three versions of this package—x86, x64, and IA64–that can be used on the corresponding versions of Windows. This package only installs release versions of Visual C++ libraries. Debug versions can either be deployed as private assemblies or by using the debug versions of Visual C++ Merge Modules. Debug versions of merge modules can be packaged together with the debug version of the application using Setup and Deployment project as described in How to: Deploy a Setup and Deployment Project. For more information, see Preparing a Test Machine To Run a Debug Executable.

To deploy Visual C++ libraries by using Visual C++ Redistributable Package, perform the following steps:

Steps

  1. Create a folder structure on the development computer that matches the folder structure to be used on the target computer. For this example, create a \bin folder and copy myapplication.exe there. Then create a \bin\mylibrary folder and copy MyLibrary.dll there.

  2. Copy this folder to the target computer.

  3. Copy Visual C++ Redistributable Package (vcredist_x86.exe) from %WindowsSdkDir%\Bootstrapper\Packages\vcredist_x86\vcredist_x86.exe to the target computer

    NoteNote:

    For applications built in Visual C++ Express, it is recommended to redistribute Visual C++ libraries using the Visual C++ Redistributable Package (vcredist_x86.exe). Visual C++ Express does not install this package; however, it can be downloaded from Microsoft Visual C++ 2008 Redistributable Package (x86).

  4. Run vcredist_x86.exe on the target computer.This installs all Visual C++ libraries as shared assemblies. On a target computer with support for manifest-based binding of applications to their dependencies (Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Vista) the libraries are installed in the WinSxS folder. On a computer without such support (Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows 2000), the libraries are installed to both the WinSxS and System32 folders.

    NoteNote:

    For deploying 64-bit applications to 64-bit operating systems, use vcredist_x64.exe or vcredist_ia64.exe. These packages can also be downloaded from Microsoft Visual C++ 2008 Redistributable Package (x64) and Microsoft Visual C++ 2008 Redistributable Package (ia64)

    NoteNote:

    vcredist_*.exe installs only the release versions of Visual C++ DLLs. Debug versions should only be deployed as private assemblies; see the next procedure for more details.

    NoteNote:

    Running vcredist_x86.exe on Windows Vista requires elevation.

  5. Your application is ready to be run.

In this scenario, the application is deployed by just copying a folder from the development computer to the target computer, and installing dependent assemblies as private side-by-side assemblies. To deploy Visual C++ libraries as private assemblies, perform the following steps:

Steps

  1. Create a folder structure on the development computer that matches the folder structure to be used on the target computer. For this example, create a \bin folder and copy myapplication.exe there. Then create a \bin\mylibrary folder and copy MyLibrary.dll there.

  2. On the development computer, from %PROGDIR%\Microsoft Visual Studio 9.0\VC\Redist\x86, copy Microsoft.VC90.CRT and Microsoft.VC90.MFC to \bin and to \bin\MyLibrary.

    NoteNote:

    Visual C++ Express does not create %PROGDIR%\Microsoft Visual Studio 9.0\VC\Redist\ during installation on the development computer. To redistribute Visual C++ libraries with applications built with Visual C++ Express, please use Visual C++ Redistributable Packages (VCRedist_*.exe). See section "Deploying Visual C++ library DLLs as shared assemblies" above for more information.

    NoteNote:

    For deploying 64-bit applications to 64-bit operating systems, use \vc\redist\amd64 or \vc\redist\ia64.

  3. Copy the \bin folder to the target computer. On a target computer with manifest-based binding support (Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Vista) no further preparation is necessary. On a computer without such support (Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows 2000), Microsoft.VC90.CRT and Microsoft.VC90.MFC must be on the path.

    NoteNote:

    For debug applications, use debug DLLs from \vc\redist\debug_nonredist\. However, remote debugging may not work for an application that deploys debug versions of Visual C++ libraries as private assemblies. For more information, see Preparing a Test Machine To Run a Debug Executable.

    NoteNote:

    If you want to do remote debugging on the target machine, you must copy over the debug DLLs or follow the procedure to install debug DLLs in Preparing a Test Machine To Run a Debug Executable.

Date

History

Reason

October 2008

Removed out-of-date content.

Customer feedback.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Installing Microsoft.VC90.CRT as private assembly in several folders is not a good idea!      erni   |   Edit   |   Show History

If you install Microsoft.VC90.CRT in more than one folder, you have to keep in mind that there may be more than one instance (*) of the runtime-library in memory if you embed a manifest in a DLL. This results in many problems. In example you cannot allocate memory in one instance and free this in a different one.

The best way is to create a dependency manifest in only one place (the executable). And build the extension DLL without a manifest. (/manifest:no as linker option).


(*) This behavior occurs only, if the runtime is not installed in WinSxS


Tags What's this?: Add a tag
Flag as ContentBug
Not enough      Ruud van Gaal   |   Edit   |   Show History
It seems just copying the Microsoft.VC90.* directories is not enough. Perhaps you need to reference them in your manifest file(s). At least this solution doesn't work for me (after having compiled an exe using CRT dll's, then trying to get the local copy to run).

Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker