Export (0) Print
Expand All

Project Class

Note: This API is now obsolete.

Represents a project that can be built using MSBuild.

System.Object
  Microsoft.Build.BuildEngine.Project

Namespace:  Microsoft.Build.BuildEngine
Assembly:  Microsoft.Build.Engine (in Microsoft.Build.Engine.dll)

[ObsoleteAttribute("This class has been deprecated. Please use Microsoft.Build.Evaluation.Project from the Microsoft.Build assembly instead.")]
public class Project

The Project type exposes the following members.

  NameDescription
Public methodProject()Initializes a new instance of the Project class.
Public methodProject(Engine)Initializes a new instance of the Project class using the supplied Engine.
Public methodProject(Engine, String)Initializes a new instance of the Project class using the supplied Engine and ToolsVersion.
Top

  NameDescription
Public propertyBuildEnabledGets or sets a value indicating whether the project is enabled for building tasks and targets.
Public propertyDefaultTargetsGets or sets the DefaultTargets attribute of the Project element in the MSBuild project.
Public propertyDefaultToolsVersionSets or gets the ToolsVersion XML attribute found on the [Project]Project Element (MSBuild) element in the project file.
Public propertyEncodingGets the encoding for the project file.
Public propertyEvaluatedItemsGets a collection of the items evaluated during the build.
Public propertyEvaluatedItemsIgnoringConditionGets a collection of all items in a project, even those not used in the build process because a Condition attribute evaluated to false.
Public propertyEvaluatedPropertiesGets a collection of the properties evaluated during the build.
Public propertyFullFileNameGets or sets the fully qualified path and file name of the project file.
Public propertyGlobalPropertiesGets or sets a collection of the global properties for the project.
Public propertyHasToolsVersionAttributeGets whether the Project file has the ToolsVersion XML attribute.
Public propertyImportsGets the projects imported into this project.
Public propertyInitialTargetsGets or sets the InitialTargets attribute of the Project element in the MSBuild project.
Public propertyIsDirtyGets a value indicating whether the project has changed and needs to be saved to a file.
Public propertyIsValidatedGets a value indicating whether the project is to be validated against a schema.
Public propertyItemGroupsGets a collection of the item groups specified with the ItemGroup element in the project.
Public propertyParentEngineGets the Engine that builds the project.
Public propertyPropertyGroupsGets a collection of the property groups specified with the PropertyGroup element in the project.
Public propertySchemaFileGets or sets the XML schema file to use when validating the project.
Public propertyTargetsGets the targets in the project.
Public propertyTimeOfLastDirtyGets a DateTime object indicating the time the project was last changed in a way that required it to be saved to a file.
Public propertyToolsVersionSets or gets the current version of the Toolset being used by the project.
Public propertyUsingTasksGets a collection of the UsingTask elements in the project.
Public propertyXmlGets the XML representing the project.
Top

  NameDescription
Public methodAddNewImportAdd an Import element to the end of the project.
Public methodAddNewItem(String, String)Adds the specified Item element to the project.
Public methodAddNewItem(String, String, Boolean)Adds the specified Item element to the project.
Public methodAddNewItemGroupAdds a new ItemGroup element to the project.
Public methodAddNewPropertyGroupAdds a new PropertyGroup element to the project.
Public methodAddNewUsingTaskFromAssemblyFileAdds a new UsingTask element with the specified assembly file.
Public methodAddNewUsingTaskFromAssemblyNameAdds a new UsingTask element with the specified assembly name.
Public methodBuild()Builds the default targets of the project.
Public methodBuild(String)Builds the specified target in the project.
Public methodBuild(String[])Builds the specified list of targets in the project.
Public methodBuild(String[], IDictionary)Builds the specified list of targets in the project, and returns the outputs of the targets.
Public methodBuild(String[], IDictionary, BuildSettings)Builds the specified list of targets in the project using the specified settings, and returns the outputs of the targets.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetConditionedPropertyValuesReturns a list of possible values for the specified property.
Public methodGetEvaluatedItemsByNameReturns all evaluated items belonging to the specified item collection.
Public methodGetEvaluatedItemsByNameIgnoringConditionReturns all items belonging to the specified item collection.
Public methodGetEvaluatedPropertyReturns the value of the specified property.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetProjectExtensionsReturns a string value of the XML from the specified element in the ProjectExtensions element.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodLoad(String)Loads the contents of the specified project file into the Project object.
Public methodLoad(TextReader)Loads the contents of the specified TextReader into the Project object.
Public methodLoad(String, ProjectLoadSettings)Reads the contents of this project from a project XML file on disk.
Public methodLoad(TextReader, ProjectLoadSettings)Reads the contents of this project from a string containing the XML contents.
Public methodLoadXml(String)Loads the contents of the specified string into the Project object.
Public methodLoadXml(String, ProjectLoadSettings)Reads the contents of this project from a string containing the XML contents.
Public methodMarkProjectAsDirtySets the IsDirty property of the project to true.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodRemoveAllItemGroupsRemoves all item groups from the project, but does not modify imported projects.
Public methodRemoveAllPropertyGroupsRemoves all property groups from the project, but does not modify imported projects.
Public methodRemoveImportedPropertyGroupRemoves the specified property group from the main project file.
Public methodRemoveItemRemoves the specified item from the project.
Public methodRemoveItemGroupRemoves the specified item group from the project.
Public methodRemoveItemGroupsWithMatchingConditionRemoves all item groups with the specified condition from the project, but does not modify imported projects.
Public methodRemoveItemsByNameRemoves all items in the specified item collection from the project, but does not modify imported projects.
Public methodRemovePropertyGroupRemoves the specified property group from the project.
Public methodRemovePropertyGroupsWithMatchingCondition(String)Removes all property groups with the specified condition from the project, but does not modify imported projects.
Public methodRemovePropertyGroupsWithMatchingCondition(String, Boolean)Removes all <PropertyGroup>'s from the main project file that have a specific "Condition."
Public methodResetBuildStatusResets the status every target in the project so that the next build will build all targets again.
Public methodSave(String)Saves the project to the specified file.
Public methodSave(TextWriter)Saves the project in the specified TextWriter object.
Public methodSave(String, Encoding)Saves the project in the specified file with the specified encoding.
Public methodSetImportedProperty(String, String, String, Project)Sets the value of a property in the specified imported project.
Public methodSetImportedProperty(String, String, String, Project, PropertyPosition)Sets the value of a property in the specified imported project.
Public methodSetImportedProperty(String, String, String, Project, PropertyPosition, Boolean)Sets the value of a property in the specified imported project.
Public methodSetProjectExtensionsSets the ProjectExtensions element of the project with the specified element name and content.
Public methodSetProperty(String, String)Sets the value of the specified property.
Public methodSetProperty(String, String, String)Sets the value of the specified property.
Public methodSetProperty(String, String, String, PropertyPosition)Sets the value of the specified property.
Public methodSetProperty(String, String, String, PropertyPosition, Boolean)Sets the value of the specified property.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Obsolete (compiler warning) in 4.5
Obsolete (compiler warning) in 4.5.1
Obsolete (compiler warning) in 4.5.2
Obsolete (compiler warning) in 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft