Project Project Project Project Class

Definition

Warning

This API is now obsolete.

Represents a project that can be built using MSBuild.

public ref class Project
[System.Obsolete("This class has been deprecated. Please use Microsoft.Build.Evaluation.Project from the Microsoft.Build assembly instead.")]
public class Project
type Project = class
Public Class Project
Inheritance
ProjectProjectProjectProject
Attributes

Remarks

A Project represents an MSBuild project. It is a container for items, properties and targets. It can load project content from in-memory XML or from an XML file, and can save to an XML file, preserving most white space and all XML comments.

Every Project must be associated with an Engine to access shared information. During a build, the Engine object keeps track of which projects are currently building.

Constructors

Project() Project() Project() Project()

Initializes a new instance of the Project class.

Project(Engine) Project(Engine) Project(Engine) Project(Engine)

Initializes a new instance of the Project class using the supplied Engine.

Project(Engine, String) Project(Engine, String) Project(Engine, String) Project(Engine, String)

Initializes a new instance of the Project class using the supplied Engine and ToolsVersion.

Properties

BuildEnabled BuildEnabled BuildEnabled BuildEnabled

Gets or sets a value indicating whether the project is enabled for building tasks and targets.

DefaultTargets DefaultTargets DefaultTargets DefaultTargets

Gets or sets the DefaultTargets attribute of the Project element in the MSBuild project.

DefaultToolsVersion DefaultToolsVersion DefaultToolsVersion DefaultToolsVersion

Sets or gets the ToolsVersion XML attribute found on the Project element in the project file.

Encoding Encoding Encoding Encoding

Gets the encoding for the project file.

EvaluatedItems EvaluatedItems EvaluatedItems EvaluatedItems

Gets a collection of the items evaluated during the build.

EvaluatedItemsIgnoringCondition EvaluatedItemsIgnoringCondition EvaluatedItemsIgnoringCondition EvaluatedItemsIgnoringCondition

Gets a collection of all items in a project, even those not used in the build process because a Condition attribute evaluated to false.

EvaluatedProperties EvaluatedProperties EvaluatedProperties EvaluatedProperties

Gets a collection of the properties evaluated during the build.

FullFileName FullFileName FullFileName FullFileName

Gets or sets the fully qualified path and file name of the project file.

GlobalProperties GlobalProperties GlobalProperties GlobalProperties

Gets or sets a collection of the global properties for the project.

HasToolsVersionAttribute HasToolsVersionAttribute HasToolsVersionAttribute HasToolsVersionAttribute

Gets whether the Project file has the ToolsVersion XML attribute.

Imports Imports Imports Imports

Gets the projects imported into this project.

InitialTargets InitialTargets InitialTargets InitialTargets

Gets or sets the InitialTargets attribute of the Project element in the MSBuild project.

IsDirty IsDirty IsDirty IsDirty

Gets a value indicating whether the project has changed and needs to be saved to a file.

IsValidated IsValidated IsValidated IsValidated

Gets a value indicating whether the project is to be validated against a schema.

ItemGroups ItemGroups ItemGroups ItemGroups

Gets a collection of the item groups specified with the ItemGroup element in the project.

ParentEngine ParentEngine ParentEngine ParentEngine

Gets the Engine that builds the project.

PropertyGroups PropertyGroups PropertyGroups PropertyGroups

Gets a collection of the property groups specified with the PropertyGroup element in the project.

SchemaFile SchemaFile SchemaFile SchemaFile

Gets or sets the XML schema file to use when validating the project.

Targets Targets Targets Targets

Gets the targets in the project.

TimeOfLastDirty TimeOfLastDirty TimeOfLastDirty TimeOfLastDirty

Gets a DateTime object indicating the time the project was last changed in a way that required it to be saved to a file.

ToolsVersion ToolsVersion ToolsVersion ToolsVersion

Sets or gets the current version of the Toolset being used by the project.

UsingTasks UsingTasks UsingTasks UsingTasks

Gets a collection of the UsingTask elements in the project.

Xml Xml Xml Xml

Gets the XML representing the project.

Methods

AddNewImport(String, String) AddNewImport(String, String) AddNewImport(String, String) AddNewImport(String, String)

Adds an Import element to the end of the project.

AddNewItem(String, String) AddNewItem(String, String) AddNewItem(String, String) AddNewItem(String, String)

Adds the specified Item element to the project.

AddNewItem(String, String, Boolean) AddNewItem(String, String, Boolean) AddNewItem(String, String, Boolean) AddNewItem(String, String, Boolean)

Adds the specified Item element to the project.

AddNewItemGroup() AddNewItemGroup() AddNewItemGroup() AddNewItemGroup()

Adds a new ItemGroup element to the project.

AddNewPropertyGroup(Boolean) AddNewPropertyGroup(Boolean) AddNewPropertyGroup(Boolean) AddNewPropertyGroup(Boolean)

Adds a new PropertyGroup element to the project.

AddNewUsingTaskFromAssemblyFile(String, String) AddNewUsingTaskFromAssemblyFile(String, String) AddNewUsingTaskFromAssemblyFile(String, String) AddNewUsingTaskFromAssemblyFile(String, String)

Adds a new UsingTask element with the specified assembly file.

AddNewUsingTaskFromAssemblyName(String, String) AddNewUsingTaskFromAssemblyName(String, String) AddNewUsingTaskFromAssemblyName(String, String) AddNewUsingTaskFromAssemblyName(String, String)

Adds a new UsingTask element with the specified assembly name.

Build() Build() Build() Build()

Builds the default targets of the project.

Build(String) Build(String) Build(String) Build(String)

Builds the specified target in the project.

Build(String[]) Build(String[]) Build(String[]) Build(String[])

Builds the specified list of targets in the project.

Build(String[], IDictionary) Build(String[], IDictionary) Build(String[], IDictionary) Build(String[], IDictionary)

Builds the specified list of targets in the project, and returns the outputs of the targets.

Build(String[], IDictionary, BuildSettings) Build(String[], IDictionary, BuildSettings) Build(String[], IDictionary, BuildSettings) Build(String[], IDictionary, BuildSettings)

Builds the specified list of targets in the project using the specified settings, and returns the outputs of the targets.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetConditionedPropertyValues(String) GetConditionedPropertyValues(String) GetConditionedPropertyValues(String) GetConditionedPropertyValues(String)

Returns a list of possible values for the specified property.

GetEvaluatedItemsByName(String) GetEvaluatedItemsByName(String) GetEvaluatedItemsByName(String) GetEvaluatedItemsByName(String)

Returns all evaluated items belonging to the specified item collection.

GetEvaluatedItemsByNameIgnoringCondition(String) GetEvaluatedItemsByNameIgnoringCondition(String) GetEvaluatedItemsByNameIgnoringCondition(String) GetEvaluatedItemsByNameIgnoringCondition(String)

Returns all items belonging to the specified item collection.

GetEvaluatedProperty(String) GetEvaluatedProperty(String) GetEvaluatedProperty(String) GetEvaluatedProperty(String)

Returns the value of the specified property.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetProjectExtensions(String) GetProjectExtensions(String) GetProjectExtensions(String) GetProjectExtensions(String)

Returns a string value of the XML from the specified element in the ProjectExtensions element.

GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
Load(String) Load(String) Load(String) Load(String)

Loads the contents of the specified project file into the Project object.

Load(String, ProjectLoadSettings) Load(String, ProjectLoadSettings) Load(String, ProjectLoadSettings) Load(String, ProjectLoadSettings)

Reads the contents of this project from a project XML file on disk.

Load(TextReader) Load(TextReader) Load(TextReader) Load(TextReader)

Loads the contents of the specified TextReader into the Project object.

Load(TextReader, ProjectLoadSettings) Load(TextReader, ProjectLoadSettings) Load(TextReader, ProjectLoadSettings) Load(TextReader, ProjectLoadSettings)

Reads the contents of this project from a string containing the XML contents.

LoadXml(String) LoadXml(String) LoadXml(String) LoadXml(String)

Loads the contents of the specified string into the Project object.

LoadXml(String, ProjectLoadSettings) LoadXml(String, ProjectLoadSettings) LoadXml(String, ProjectLoadSettings) LoadXml(String, ProjectLoadSettings)

Reads the contents of this project from a string containing the XML contents.

MarkProjectAsDirty() MarkProjectAsDirty() MarkProjectAsDirty() MarkProjectAsDirty()

Sets the IsDirty property of the project to true.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
RemoveAllItemGroups() RemoveAllItemGroups() RemoveAllItemGroups() RemoveAllItemGroups()

Removes all item groups from the project, but does not modify imported projects.

RemoveAllPropertyGroups() RemoveAllPropertyGroups() RemoveAllPropertyGroups() RemoveAllPropertyGroups()

Removes all property groups from the project, but does not modify imported projects.

RemoveImportedPropertyGroup(BuildPropertyGroup) RemoveImportedPropertyGroup(BuildPropertyGroup) RemoveImportedPropertyGroup(BuildPropertyGroup) RemoveImportedPropertyGroup(BuildPropertyGroup)

Removes the specified property group from the main project file.

RemoveItem(BuildItem) RemoveItem(BuildItem) RemoveItem(BuildItem) RemoveItem(BuildItem)

Removes the specified item from the project.

RemoveItemGroup(BuildItemGroup) RemoveItemGroup(BuildItemGroup) RemoveItemGroup(BuildItemGroup) RemoveItemGroup(BuildItemGroup)

Removes the specified item group from the project.

RemoveItemGroupsWithMatchingCondition(String) RemoveItemGroupsWithMatchingCondition(String) RemoveItemGroupsWithMatchingCondition(String) RemoveItemGroupsWithMatchingCondition(String)

Removes all item groups with the specified condition from the project, but does not modify imported projects.

RemoveItemsByName(String) RemoveItemsByName(String) RemoveItemsByName(String) RemoveItemsByName(String)

Removes all items in the specified item collection from the project, but does not modify imported projects.

RemovePropertyGroup(BuildPropertyGroup) RemovePropertyGroup(BuildPropertyGroup) RemovePropertyGroup(BuildPropertyGroup) RemovePropertyGroup(BuildPropertyGroup)

Removes the specified property group from the project.

RemovePropertyGroupsWithMatchingCondition(String) RemovePropertyGroupsWithMatchingCondition(String) RemovePropertyGroupsWithMatchingCondition(String) RemovePropertyGroupsWithMatchingCondition(String)

Removes all property groups with the specified condition from the project, but does not modify imported projects.

RemovePropertyGroupsWithMatchingCondition(String, Boolean) RemovePropertyGroupsWithMatchingCondition(String, Boolean) RemovePropertyGroupsWithMatchingCondition(String, Boolean) RemovePropertyGroupsWithMatchingCondition(String, Boolean)

Removes all <PropertyGroup>'s from the main project file that have a specific "Condition."

ResetBuildStatus() ResetBuildStatus() ResetBuildStatus() ResetBuildStatus()

Resets the status every target in the project so that the next build will build all targets again.

Save(String) Save(String) Save(String) Save(String)

Saves the project to the specified file.

Save(String, Encoding) Save(String, Encoding) Save(String, Encoding) Save(String, Encoding)

Saves the project in the specified file with the specified encoding.

Save(TextWriter) Save(TextWriter) Save(TextWriter) Save(TextWriter)

Saves the project in the specified TextWriter object.

SetImportedProperty(String, String, String, Project) SetImportedProperty(String, String, String, Project) SetImportedProperty(String, String, String, Project) SetImportedProperty(String, String, String, Project)

Sets the value of a property in the specified imported project.

SetImportedProperty(String, String, String, Project, PropertyPosition) SetImportedProperty(String, String, String, Project, PropertyPosition) SetImportedProperty(String, String, String, Project, PropertyPosition) SetImportedProperty(String, String, String, Project, PropertyPosition)

Sets the value of a property in the specified imported project.

SetImportedProperty(String, String, String, Project, PropertyPosition, Boolean) SetImportedProperty(String, String, String, Project, PropertyPosition, Boolean) SetImportedProperty(String, String, String, Project, PropertyPosition, Boolean) SetImportedProperty(String, String, String, Project, PropertyPosition, Boolean)

Sets the value of a property in the specified imported project.

SetProjectExtensions(String, String) SetProjectExtensions(String, String) SetProjectExtensions(String, String) SetProjectExtensions(String, String)

Sets the ProjectExtensions element of the project with the specified element name and content.

SetProperty(String, String) SetProperty(String, String) SetProperty(String, String) SetProperty(String, String)

Sets the value of the specified property.

SetProperty(String, String, String) SetProperty(String, String, String) SetProperty(String, String, String) SetProperty(String, String, String)

Sets the value of the specified property.

SetProperty(String, String, String, PropertyPosition) SetProperty(String, String, String, PropertyPosition) SetProperty(String, String, String, PropertyPosition) SetProperty(String, String, String, PropertyPosition)

Sets the value of the specified property.

SetProperty(String, String, String, PropertyPosition, Boolean) SetProperty(String, String, String, PropertyPosition, Boolean) SetProperty(String, String, String, PropertyPosition, Boolean) SetProperty(String, String, String, PropertyPosition, Boolean)

Sets the value of the specified property.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to