Compartilhar via


IVsSharedProjectQueryCanBeReferenced.QueryCanSharedProjectBeReferenced Method

Definition

Called by the EnumAllAvailableSharedProjects(IVsHierarchy) implementation in order to filter the list of Shared Projects to only valid choices for the ReferencingProject.

public:
 System::UInt32 QueryCanSharedProjectBeReferenced(Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ ReferencingProject);
public:
 unsigned int QueryCanSharedProjectBeReferenced(Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ ReferencingProject);
unsigned int QueryCanSharedProjectBeReferenced(Microsoft::VisualStudio::Shell::Interop::IVsHierarchy const & ReferencingProject);
public uint QueryCanSharedProjectBeReferenced (Microsoft.VisualStudio.Shell.Interop.IVsHierarchy ReferencingProject);
abstract member QueryCanSharedProjectBeReferenced : Microsoft.VisualStudio.Shell.Interop.IVsHierarchy -> uint32
Public Function QueryCanSharedProjectBeReferenced (ReferencingProject As IVsHierarchy) As UInteger

Parameters

ReferencingProject
IVsHierarchy

The project that wants to add a Shared Project Reference.

Returns

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

Remarks

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>  

Applies to