다음을 통해 공유


Deploying Multiple Versions of an Application or Component

You can deploy assemblies intended for side-by-side execution in the following ways:

  • Private deployment.

    You can deploy an assembly into the application directory or in a subdirectory of the application directory. The common language runtime locates the assembly using default binding resolution behavior. For more information about assembly binding resolution, see How the Runtime Locates Assemblies.

    Privately deployed assemblies are a convenient way to deploy an application for side-by-side execution because such assemblies cannot affect other assemblies on the computer. Furthermore, you can privately deploy both strong-named assemblies and assemblies without strong names. Strong-named assemblies do not have to be deployed in the global assembly cache; they can be deployed in the application directory. If you do not intend to share an assembly across multiple applications, deploy the assembly privately in the application directory.

    An additional advantage to private deployment is the ability to use XCOPY to deploy the application.

  • Global assembly cache deployment.

    Installing an assembly in the global assembly cache makes the assembly visible to all applications on a computer. This type of deployment is appropriate when an assembly is to be shared across multiple applications. Note that only strong-named assemblies can be deployed into the global assembly cache.

    Both the Windows Installer and the Global Assembly Cache tool (Gacutil.exe) can install assemblies in the global assembly cache. The Global Assembly Cache tool should be used during development and testing, while the Windows Installer is the preferred tool for actual application deployment. The Windows Installer tracks references to assemblies installed in the global assembly cache so shared assemblies are not uninstalled while an application on the computer still needs the assembly. For more information about installing side-by-side applications, see Using the Windows Installer to Install Applications and Components for Side-by-Side Execution.

  • Deployment using the <codeBase> element.

    The <codeBase> element can be included in the application configuration file to help the runtime locate assemblies. The runtime uses the location specified in the <codeBase> element instead of searching for the assembly using the default rules it employs to locate assemblies. The <codeBase> element can be used for both strong-named assemblies and assemblies without strong names.

    For assemblies without strong names, <codeBase> elements must be relative to the application directory. This requirement ensures that side-by-side execution occurs without naming collisions, in which the runtime locates two assemblies with the same name.

    For strong-named assemblies, <codeBase> elements can direct the runtime to any location. The <codeBase> elements provide a mechanism for sharing strong-named assemblies across applications without using the global assembly cache. However, this deployment method should be used with care as you could easily break an application by entering an incorrect <codeBase> element when changing versions.

For a complete discussion of deployment, see Deploying Applications.

See Also

Using the Windows Installer to Install Applications and Components for Side-by-Side Execution | Deploying Applications | Guidelines for Creating Applications and Components for Side-by-Side Execution | Creating Multiple Versions of an Application or Component