IVsSharedProjectQueryCanBeReferenced::QueryCanSharedProjectBeReferenced Method (IVsHierarchy^)

Visual Studio 2015
 

Called by the T:Microsoft.VisualStudio.Shell.Interop.IVsSharedMSBuildFilesManagerHierarchy2.EnumAllAvailableSharedProjects(Microsoft.VisualStudio.Shell.Interop.IVsHierarchy) implementation in order to filter the list of Shared Projects to only valid choices for the ReferencingProject.

Namespace:   Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime (in Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.dll)

unsigned int QueryCanSharedProjectBeReferenced(
	IVsHierarchy^ ReferencingProject
)

Parameters

ReferencingProject
Type: Microsoft.VisualStudio.Shell.Interop::IVsHierarchy^

The project that wants to add a Shared Project Reference.

Return Value

Type: System::UInt32

A VSREFERENCEQUERYRESULT result value that indicates whether the reference is allowed or not.

The minimum expected implementation of this method by a Shared Project is to enforce that the language of the Shared Project is compatible with the language of the referencingProject. This check is normally made by performing an IsCapabilitiesMatch check. e.g.:

return referencingProject.IsCapabilityMatch($(SharedProjectAppliesTo));

where the $(SharedProjectAppliesTo) property of the Shared Project is a Capabilities expression thatensures that the referencingProject is of a compatible language (and possibly other criteria for advanced Shared Project scenarios).For example the SharedProjectAppliesTo property defined in the Microsoft.CSharp.CodeSharing.targets file is the following

<SharedProjectAppliesTo>CSharp<\SharedProjectAppliesTo>
Return to top
Show: