How to: Deploy using XCopy

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.

Deploying Visual C++ library DLLs as shared assemblies

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

    Note

    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.

    Note

    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)

    Note

    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.

    Note

    Running vcredist_x86.exe on Windows Vista requires elevation.

  5. Your application is ready to be run.

Deploying Visual C++ library DLLs as private assemblies

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.

    Note

    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.

    Note

    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.

    Note

    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.

    Note

    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.

See Also

Tasks

How to: Deploy a Setup and Deployment Project

Concepts

Deployment Examples

Redistributing an Application and Binding It to Specific Libraries

Change History

Date

History

Reason

October 2008

Removed out-of-date content.

Customer feedback.