Aracılığıyla paylaş


Project.RemoveItem(ProjectItem) Method

Definition

Removes an item from the project. Item must be associated with this project. Item must not originate from an imported file. Returns true if the item was in this evaluated project, otherwise false. As a convenience, if the parent item group becomes empty, it is also removed. If the item originated from a wildcard or semicolon separated expression, expands that expression into multiple items first. Updates the evaluated project, but does not affect anything else in the project until reevaluation. For example, if an item of type "i" is removed, "j" which is evaluated from "@(i)" will not be modified until reevaluation. This is a convenience that it is understood does not necessarily leave the project in a perfectly self consistent state until reevaluation.

public:
 bool RemoveItem(Microsoft::Build::Evaluation::ProjectItem ^ item);
public bool RemoveItem (Microsoft.Build.Evaluation.ProjectItem item);
member this.RemoveItem : Microsoft.Build.Evaluation.ProjectItem -> bool
Public Function RemoveItem (item As ProjectItem) As Boolean

Parameters

item
ProjectItem

The item to be removed.

Returns

true if the item is present in this evaluated project; otherwise, false. Normally this method returns true, since if the requested item is not present, the method throws an exception. If the item is present only in the ItemsIgnoringCondition collection, however, the method returns false.

Remarks

Normally this will return true, since if the item isn't in the project, it will throw. The exception is removing an item that was only in ItemsIgnoringCondition.

Applies to