Project Class
Note: This API is now obsolete.
Represents a project that can be built using MSBuild.
Assembly: Microsoft.Build.Engine (in Microsoft.Build.Engine.dll)
The Project type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Project() | Initializes a new instance of the Project class. |
![]() | Project(Engine) | Initializes a new instance of the Project class using the supplied Engine. |
![]() | Project(Engine, String) | Initializes a new instance of the Project class using the supplied Engine and ToolsVersion. |
| Name | Description | |
|---|---|---|
![]() | BuildEnabled | Gets or sets a value indicating whether the project is enabled for building tasks and targets. |
![]() | DefaultTargets | Gets or sets the DefaultTargets attribute of the Project element in the MSBuild project. |
![]() | DefaultToolsVersion | Sets or gets the ToolsVersion XML attribute found on the [Project]Project Element (MSBuild) element in the project file. |
![]() | Encoding | Gets the encoding for the project file. |
![]() | EvaluatedItems | Gets a collection of the items evaluated during the build. |
![]() | 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 | Gets a collection of the properties evaluated during the build. |
![]() | FullFileName | Gets or sets the fully qualified path and file name of the project file. |
![]() | GlobalProperties | Gets or sets a collection of the global properties for the project. |
![]() | HasToolsVersionAttribute | Gets whether the Project file has the ToolsVersion XML attribute. |
![]() | Imports | Gets the projects imported into this project. |
![]() | InitialTargets | Gets or sets the InitialTargets attribute of the Project element in the MSBuild project. |
![]() | IsDirty | Gets a value indicating whether the project has changed and needs to be saved to a file. |
![]() | IsValidated | Gets a value indicating whether the project is to be validated against a schema. |
![]() | ItemGroups | Gets a collection of the item groups specified with the ItemGroup element in the project. |
![]() | ParentEngine | Gets the Engine that builds the project. |
![]() | PropertyGroups | Gets a collection of the property groups specified with the PropertyGroup element in the project. |
![]() | SchemaFile | Gets or sets the XML schema file to use when validating the project. |
![]() | Targets | Gets the targets in the project. |
![]() | 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 | Sets or gets the current version of the Toolset being used by the project. |
![]() | UsingTasks | Gets a collection of the UsingTask elements in the project. |
![]() | Xml | Gets the XML representing the project. |
| Name | Description | |
|---|---|---|
![]() | AddNewImport | Add an Import element to the end of the project. |
![]() | AddNewItem(String, String) | Adds the specified Item element to the project. |
![]() | AddNewItem(String, String, Boolean) | Adds the specified Item element to the project. |
![]() | AddNewItemGroup | Adds a new ItemGroup element to the project. |
![]() | AddNewPropertyGroup | Adds a new PropertyGroup element to the project. |
![]() | AddNewUsingTaskFromAssemblyFile | Adds a new UsingTask element with the specified assembly file. |
![]() | AddNewUsingTaskFromAssemblyName | Adds a new UsingTask element with the specified assembly name. |
![]() | Build() | Builds the default targets of the project. |
![]() | Build(String) | Builds the specified target in the project. |
![]() | Build(array<String>) | Builds the specified list of targets in the project. |
![]() | Build(array<String>, IDictionary) | Builds the specified list of targets in the project, and returns the outputs of the targets. |
![]() | Build(array<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) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetConditionedPropertyValues | Returns a list of possible values for the specified property. |
![]() | GetEvaluatedItemsByName | Returns all evaluated items belonging to the specified item collection. |
![]() | GetEvaluatedItemsByNameIgnoringCondition | Returns all items belonging to the specified item collection. |
![]() | GetEvaluatedProperty | Returns the value of the specified property. |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetProjectExtensions | Returns a string value of the XML from the specified element in the ProjectExtensions element. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | Load(String) | Loads the contents of the specified project file into the Project object. |
![]() | Load(TextReader) | Loads the contents of the specified TextReader into the Project object. |
![]() | Load(String, ProjectLoadSettings) | Reads the contents of this project from a project XML file on disk. |
![]() | Load(TextReader, ProjectLoadSettings) | Reads the contents of this project from a string containing the XML contents. |
![]() | LoadXml(String) | Loads the contents of the specified string into the Project object. |
![]() | LoadXml(String, ProjectLoadSettings) | Reads the contents of this project from a string containing the XML contents. |
![]() | MarkProjectAsDirty | Sets the IsDirty property of the project to true. |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | RemoveAllItemGroups | Removes all item groups from the project, but does not modify imported projects. |
![]() | RemoveAllPropertyGroups | Removes all property groups from the project, but does not modify imported projects. |
![]() | RemoveImportedPropertyGroup | Removes the specified property group from the main project file. |
![]() | RemoveItem | Removes the specified item from the project. |
![]() | RemoveItemGroup | Removes the specified item group from the project. |
![]() | RemoveItemGroupsWithMatchingCondition | Removes all item groups with the specified condition from the project, but does not modify imported projects. |
![]() | RemoveItemsByName | Removes all items in the specified item collection from the project, but does not modify imported projects. |
![]() | RemovePropertyGroup | Removes the specified property group from the project. |
![]() | RemovePropertyGroupsWithMatchingCondition(String) | Removes all property groups with the specified condition from the project, but does not modify imported projects. |
![]() | RemovePropertyGroupsWithMatchingCondition(String, Boolean) | Removes all <PropertyGroup>'s from the main project file that have a specific "Condition." |
![]() | ResetBuildStatus | Resets the status every target in the project so that the next build will build all targets again. |
![]() | Save(String) | Saves the project to the specified file. |
![]() | Save(TextWriter) | Saves the project in the specified TextWriter object. |
![]() | Save(String, Encoding) | Saves the project in the specified file with the specified encoding. |
![]() | SetImportedProperty(String, String, String, Project) | Sets the value of a property in the specified imported project. |
![]() | SetImportedProperty(String, String, String, Project, PropertyPosition) | Sets the value of a property in the specified imported project. |
![]() | SetImportedProperty(String, String, String, Project, PropertyPosition, Boolean) | Sets the value of a property in the specified imported project. |
![]() | SetProjectExtensions | Sets the ProjectExtensions element of the project with the specified element name and content. |
![]() | SetProperty(String, String) | Sets the value of the specified property. |
![]() | SetProperty(String, String, String) | Sets the value of the specified property. |
![]() | SetProperty(String, String, String, PropertyPosition) | Sets the value of the specified property. |
![]() | SetProperty(String, String, String, PropertyPosition, Boolean) | Sets the value of the specified property. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
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 whitespace 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.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
