Retargetable Assemblies

Retargeting refers to the ability to map an assembly that is built on one .NET Framework implementation to a corresponding assembly that is built on another .NET Framework implementation. This feature typically is used to allow a managed application that was written for a device to run on the desktop.

For example, applications that are written for the .NET Compact Framework use assembly retargeting to run on the desktop. This provides a unified experience across platforms. To enable this scenario, the AssemblyFlagsAttribute attribute with the AssemblyNameFlags.Retargetable flag is applied to the assemblies in the .NET Compact Framework. The common language runtime (CLR) detects this attribute and uses an internal retargeting table to select the correct .NET Framework assembly on the desktop.

Assemblies that you build on the .NET Framework do not use a retargeting table. To enable retargeting of one of your assemblies, the following must be true:

  • On all .NET Framework implementations for which your assembly is built, the assembly must have the same strong name, including the same public and private keys.

  • On any source .NET Framework implementation from which retargeting will occur, your assembly must have the AssemblyFlagsAttribute attribute with the AssemblyNameFlags.Retargetable flag. The attribute is not required on assemblies that will only be destinations.

See Also

Concepts

Assembly Binding Redirection

Other Resources

Deploying the .NET Framework and Applications