Partilhar via


Reference.CopyLocal Property

Definition

Determines whether the reference is copied to the local bin path.

public:
 property bool CopyLocal { bool get(); void set(bool value); };
public:
 property bool CopyLocal { bool get(); void set(bool value); };
[System.Runtime.InteropServices.DispId(17)]
public bool CopyLocal { [System.Runtime.InteropServices.DispId(17)] get; [System.Runtime.InteropServices.DispId(17)] set; }
[<System.Runtime.InteropServices.DispId(17)>]
[<get: System.Runtime.InteropServices.DispId(17)>]
[<set: System.Runtime.InteropServices.DispId(17)>]
member this.CopyLocal : bool with get, set
Public Property CopyLocal As Boolean

Property Value

Boolean.

Attributes

Examples

See the example in Reference.

Remarks

At run time, assemblies must be in one of two locations: the output path of the project or the global assembly cache (see Working with Assemblies and the Global Assembly Cache). If the project contains a reference to an object that is not in one of these locations, then when the project is built, the reference must be copied to the output path of the project. The CopyLocal property indicates whether this copy needs to be made. If the value is true, the reference is copied to the output path of the project at run time. If false, the reference is not copied.

The common language runtime does not track the changes to the reference to determine if the local copy needs to be updated. Changes are tracked by the project system. As long as the user has not overridden the CopyLocal property, the value will be automatically updated by the project system if needed.

The project-assigned value of CopyLocal is determined in the following order:

  1. If the reference is another project, called a project-to-project reference, then the value is true.

  2. If the assembly is found in the global assembly cache, the value is false.

  3. As a special case, the value for the mscorlib.dll reference is false.

  4. If the assembly is found in the Framework SDK folder, then the value is false.

  5. Otherwise, the value is true.

Applies to