Project.RemoveItem Method
Removes an item from the project. The item to be removed must be present in the project, and must not originate from an imported file.
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.Evaluation
Assembly: Microsoft.Build (in Microsoft.Build.dll)
Syntax
'Declaration
Public Function RemoveItem ( _
item As ProjectItem _
) As Boolean
public bool RemoveItem(
ProjectItem item
)
public:
bool RemoveItem(
ProjectItem^ item
)
member RemoveItem :
item:ProjectItem -> bool
public function RemoveItem(
item : ProjectItem
) : boolean
Parameters
item
Type: Microsoft.Build.Evaluation.ProjectItemThe item to be removed.
Return Value
Type: System.Boolean
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
If the item group containing the item becomes empty, it is also removed.
If the item originates from a wildcard or semicolon-separated expression, the expression is first expanded into multiple items.
The project is updated, but no further evaluation occurs until reevaluation. For example, if an item of type "i" is removed, "j" which is evaluated from "@(i)" is not modified until reevaluation.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.