Compartilhar via


Project.GetAllGlobs Method

Definition

Overloads

GetAllGlobs(String, EvaluationContext)

See GetAllGlobs(String).

GetAllGlobs(String)

Overload of GetAllGlobs().

GetAllGlobs(EvaluationContext)

See GetAllGlobs().

GetAllGlobs()

Finds all the globs specified in item includes.

GetAllGlobs(String, EvaluationContext)

Source:
Project.cs
public:
 System::Collections::Generic::List<Microsoft::Build::Evaluation::GlobResult ^> ^ GetAllGlobs(System::String ^ itemType, Microsoft::Build::Evaluation::Context::EvaluationContext ^ evaluationContext);
public System.Collections.Generic.List<Microsoft.Build.Evaluation.GlobResult> GetAllGlobs (string itemType, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext);
member this.GetAllGlobs : string * Microsoft.Build.Evaluation.Context.EvaluationContext -> System.Collections.Generic.List<Microsoft.Build.Evaluation.GlobResult>
Public Function GetAllGlobs (itemType As String, evaluationContext As EvaluationContext) As List(Of GlobResult)

Parameters

itemType
String

Type of the item.

evaluationContext
EvaluationContext

The evaluation context to use in case reevaluation is required. To avoid reevaluation use RecordEvaluatedItemElements.

Returns

Applies to

GetAllGlobs(String)

Source:
Project.cs

Overload of GetAllGlobs().

public:
 System::Collections::Generic::List<Microsoft::Build::Evaluation::GlobResult ^> ^ GetAllGlobs(System::String ^ itemType);
public System.Collections.Generic.List<Microsoft.Build.Evaluation.GlobResult> GetAllGlobs (string itemType);
member this.GetAllGlobs : string -> System.Collections.Generic.List<Microsoft.Build.Evaluation.GlobResult>
Public Function GetAllGlobs (itemType As String) As List(Of GlobResult)

Parameters

itemType
String

Confine search to item elements of this type.

Returns

Applies to

GetAllGlobs(EvaluationContext)

Source:
Project.cs
public:
 System::Collections::Generic::List<Microsoft::Build::Evaluation::GlobResult ^> ^ GetAllGlobs(Microsoft::Build::Evaluation::Context::EvaluationContext ^ evaluationContext);
public System.Collections.Generic.List<Microsoft.Build.Evaluation.GlobResult> GetAllGlobs (Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext);
member this.GetAllGlobs : Microsoft.Build.Evaluation.Context.EvaluationContext -> System.Collections.Generic.List<Microsoft.Build.Evaluation.GlobResult>
Public Function GetAllGlobs (evaluationContext As EvaluationContext) As List(Of GlobResult)

Parameters

evaluationContext
EvaluationContext

The evaluation context to use in case reevaluation is required. To avoid reevaluation use RecordEvaluatedItemElements.

Returns

Applies to

GetAllGlobs()

Source:
Project.cs

Finds all the globs specified in item includes.

public:
 System::Collections::Generic::List<Microsoft::Build::Evaluation::GlobResult ^> ^ GetAllGlobs();
public System.Collections.Generic.List<Microsoft.Build.Evaluation.GlobResult> GetAllGlobs ();
member this.GetAllGlobs : unit -> System.Collections.Generic.List<Microsoft.Build.Evaluation.GlobResult>
Public Function GetAllGlobs () As List(Of GlobResult)

Returns

List of GlobResult.

Examples

<P>*.txt</P>

<Bar Include="bar"/> (both outside and inside project cone)
<Zar Include="C:\**\*.foo"/> (both outside and inside project cone)
<Foo Include="*.a;*.b" Exclude="3.a"/>
<Foo Remove="2.a" />
<Foo Include="**\*.b" Exclude="1.b;**\obj\*.b;**\bar\*.b"/>
<Foo Include="$(P)"/>
<Foo Include="*.a;@(Bar);3.a"/> (If Bar has globs, they will have been included when querying Bar ProjectItems for globs)
<Foo Include="*.cs" Exclude="@(Bar)"/>

Example result:

[
GlobResult(glob: "C:\**\*.foo", exclude: []),
GlobResult(glob: ["*.a", "*.b"], exclude=["3.a"], remove=["2.a"]),
GlobResult(glob: "**\*.b", exclude=["1.b, **\obj\*.b", **\bar\*.b"]),
GlobResult(glob: "*.txt", exclude=[]),
GlobResult(glob: "*.a", exclude=[]),
GlobResult(glob: "*.cs", exclude=["bar"])
].

Remarks

MsBuildGlob is a IMSBuildGlob that combines all globs in the include element and ignores all the fragments in the exclude attribute and all the fragments in all Remove elements that apply to the include element.

Users can construct a composite glob that incorporates all the globs in the Project:

var uberGlob = new CompositeGlob(project.GetAllGlobs().Select(r => r.MSBuildGlob).ToArray());
uberGlob.IsMatch("foo.cs");

Applies to