次の方法で共有


ResolveAssemblyReference.CopyLocalDependenciesWhenParentReferenceInGac Property

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Gets or sets a switch that determines how dependencies are determined, and whether or not a dependency is copied locally.

MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.

Namespace:  Microsoft.Build.Tasks
Assembly:  Microsoft.Build.Tasks.Core (in Microsoft.Build.Tasks.Core.dll)

Syntax

'Declaration
Public Property CopyLocalDependenciesWhenParentReferenceInGac As Boolean
public bool CopyLocalDependenciesWhenParentReferenceInGac { get; set; }
public:
property bool CopyLocalDependenciesWhenParentReferenceInGac {
    bool get ();
    void set (bool value);
}
member CopyLocalDependenciesWhenParentReferenceInGac : bool with get, set
function get CopyLocalDependenciesWhenParentReferenceInGac () : boolean 
function set CopyLocalDependenciesWhenParentReferenceInGac (value : boolean)

Property Value

Type: System.Boolean
Returns true if when determining if a dependency should be copied locally one of the checks done is to see if the parent reference in the project file has the Private metadata set or not. If that metadata is set then we will use that for the dependency as well.
If the metadata is not set then the dependency will go through the same checks as the parent reference. One of these checks is to see if the reference is in the GAC. If a reference is in the GAC then we will not copy it locally as it is assumed it will be in the gac on the target machine as well. However this only applies to that specific reference and not its dependencies.
This means a reference in the project file may be copy local false due to it being in the GAC but the dependencies may still be copied locally because they are not in the GAC. This is the default behavior for RAR and causes the default value for this property to be true.
Returns false if we will still check project file references to see if they are in the GAC and set their copy local state as appropriate.
However for dependencies we will not only check to see if they are in the GAC but we will also check to see if the parent reference from the project file is in the GAC.
If the parent reference from the project file is in the GAC then we will not copy the dependency locally.

Note

If there are multiple parent reference and ANY of them does not come from the GAC then we will set copy local to true.

.NET Framework Security

See Also

Reference

ResolveAssemblyReference Class

Microsoft.Build.Tasks Namespace