Export (0) Print
Expand All

Project Class

Represents a project with design time semantics. This class can load project files, edit items and properties and build projects.

System.Object
  Microsoft.Build.Evaluation.Project

Namespace:  Microsoft.Build.Evaluation
Assembly:  Microsoft.Build (in Microsoft.Build.dll)

public class Project

The Project type exposes the following members.

  NameDescription
Public methodProject()Constructs an empty project using the global project collection global properties and default tools version.
Public methodProject(ProjectCollection)Constructs an empty project using the given project collection global properties and default tools version.
Public methodProject(ProjectRootElement)Constructs an empty project and evaluates it using the given project root and the global project collection global properties and default tools version.
Public methodProject(String)Constructs a project and evaluates it from the given source project file and with the global project collection global properties and default tools version.
Public methodProject(XmlReader)Constructs a project and evaluates the source code from the given XML reader. The source code is evaluated with the global project collection global properties and default tools version.
Public methodProject(ProjectRootElement, IDictionary<String, String>, String)Constructs an empty project and evaluates it using the given project root and with the given global properties and given tools version.
Public methodProject(IDictionary<String, String>, String, ProjectCollection)Constructs an empty project, to be evaluated with the given project collection and with the given global properties and given tools version.
Public methodProject(String, IDictionary<String, String>, String)Constructs a project and evaluates it from the given source project file and with the given global properties and given tools version.
Public methodProject(XmlReader, IDictionary<String, String>, String)Constructs a project and evaluates the source code from the given XML reader. The source code is evaluated with the given global properties and given tools version.
Public methodProject(ProjectRootElement, IDictionary<String, String>, String, ProjectCollection)Constructs a project and evaluates it using the given project root and with the given global properties and given tools version.
Public methodProject(String, IDictionary<String, String>, String, ProjectCollection)Constructs a project and evaluates it from the given source project file and with the given global properties and given tools version.
Public methodProject(XmlReader, IDictionary<String, String>, String, ProjectCollection)Constructs a project and evaluates the source code from the given XML reader. The source code is evaluated with the given global properties and given tools version.
Public methodProject(ProjectRootElement, IDictionary<String, String>, String, ProjectCollection, ProjectLoadSettings)Constructs a project and evaluates it using the given project root and with the given global properties, given tools version, and given load settings.
Public methodProject(String, IDictionary<String, String>, String, ProjectCollection, ProjectLoadSettings)Constructs a project and evaluates it from the given source project file and with the given global properties, given tools version, and given load settings.
Public methodProject(XmlReader, IDictionary<String, String>, String, ProjectCollection, ProjectLoadSettings)Constructs a project and evaluates the source code from the given XML reader. The source code is evaluated with the given global properties and given tools version.
Public methodProject(ProjectRootElement, IDictionary<String, String>, String, String, ProjectCollection, ProjectLoadSettings)Constructs a project and evaluates it using the given project root and with the given global properties, tools and sub-toolset versions, project collection, and load settings.
Public methodProject(String, IDictionary<String, String>, String, String, ProjectCollection, ProjectLoadSettings)Constructs a project and evaluates it from the given source project file and with the given global properties, tools and sub-toolset versions, project collection, and load settings.
Public methodProject(XmlReader, IDictionary<String, String>, String, String, ProjectCollection, ProjectLoadSettings)Constructs a project and evaluates the source code from the given XML reader. The source code is evaluated with the given global properties, tools and sub-toolset versions, project collection, and load settings.
Top

  NameDescription
Public propertyAllEvaluatedItemDefinitionMetadataGets all item definition metadata encountered during evaluation.
Public propertyAllEvaluatedItemsGets an enumerator over all items encountered during evaluation. These are read during the third evaluation pass.
Public propertyAllEvaluatedPropertiesGets all properties encountered during evaluation.
Public propertyConditionedPropertiesGets a collection of possible property values for properties used to evaluate conditions found on properties, property groups, imports, and whens.
Public propertyDirectoryPathGets the root directory for this project.
Public propertyDisableMarkDirtyGets or sets a flag the determines whether MarkDirty is temporarily disabled. This allows, for example, a global property to be set without the project getting marked dirty for reevaluation as a consequence.
Public propertyEvaluationCounterGets a number that is incremented every time that project is re-evaluated.
Public propertyFullPathGets or sets the full path to the project source file.
Public propertyGlobalPropertiesGets a dictionary of the global properties used for the evaluation of this project.
Public propertyImportsGets a list of all the files that contributed to the evaluation of this project.
Public propertyImportsIncludingDuplicatesGets a list of duplicate imports if an import was imported multiple times. However, only the first import was used in evaluation.
Public propertyIsBuildEnabledGets or sets a property that selects whether the targets and tasks of this project can be built.
Public propertyIsDirtyGets a property that indicates whether this project has been modified so that it must be reevaluated.
Public propertyItemDefinitionsGets a dictionary of item definitions in this project, keyed by item type.
Public propertyItemsGets an enumerator over all items in this project, ordered within groups of item types.
Public propertyItemsIgnoringConditionGets an enumerator over all items in this project, ordered within groups of item types.
Public propertyItemTypesGets an enumerator over all item types in this project.
Public propertyProjectCollectionGets the project collection which contains this project.
Public propertyProjectFileLocationThe location of the originating file itself, not any specific content within it. If the file has not been given a name, this is an empty location. This is a legitimate case of having no location.
Public propertyPropertiesGets an enumerator over all properties in this project. This is an unordered collection.
Public propertySkipEvaluationGets or sets a flag the determines whether ReevaluateIfNecessary is temporarily disabled. This is useful when the host expects to make a number of reads and writes to the project, and wants to temporarily sacrifice correctness for performance.
Public propertySubToolsetVersionGets the value of the SubToolsetVersion attribute, if any. This value was combined with the value of the ToolsVersion attribute to determine the toolset properties for this project.
Public propertyTargetsGets a dictionary of all targets in this project, keyed by target name.
Public propertyToolsVersionGets the tools version that this project was evaluated with, if any.
Public propertyXmlGets the root project associated with this project. Can never be null
Top

  NameDescription
Public methodAddItem(String, String)Adds an item with no metadata to the project.
Public methodAddItem(String, String, IEnumerable<KeyValuePair<String, String>>)Adds an item with the given metadata to the project.
Public methodAddItemFast(String, String)Adds an item with no metadata to the project. Makes no effort to see if an existing wildcard would already match the new item, unless it is the first item in an item group. Makes no effort to locate the new item near similar items.
Public methodAddItemFast(String, String, IEnumerable<KeyValuePair<String, String>>)Adds an item with metadata to the project. Metadata may be null, indicating no metadata. Makes no effort to see if an existing wildcard would already match the new item, unless it is the first item in an item group. Makes no effort to locate the new item near similar items.
Public methodBuild()Builds this project, using the default targets.
Public methodBuild(ILogger)Builds this project, using the default targets and the given logger.
Public methodBuild(IEnumerable<ILogger>)Builds this project, using the default targets and the given loggers.
Public methodBuild(String)Builds this project, building the given target.
Public methodBuild(String[])Builds this project, building the given targets.
Public methodBuild(IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>)Builds this project, using the default targets and the given loggers and remote loggers.
Public methodBuild(String, IEnumerable<ILogger>)Builds this project, building the given target and using the given loggers.
Public methodBuild(String[], IEnumerable<ILogger>)Builds this project, building the given targets and using the given loggers.
Public methodBuild(String, IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>)Builds this project, building the given target and using the given loggers and remote loggers.
Public methodBuild(String[], IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>)Builds this project, building the given targets and using the given loggers and remote loggers.
Public methodCreateProjectInstance()Creates a project instance based on this project, but completely disconnected from it.
Public methodCreateProjectInstance(ProjectInstanceSettings)Creates a project instance based on this project, but completely disconnected from it.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodExpandStringEvaluates the given string by expanding items and properties. The string is evaluated as if it were found at the very end of the project file.
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 methodStatic memberGetEvaluatedItemIncludeEscaped(ProjectItem)Gets evaluated, escaped value of the Include attribute of the provided items.
Public methodStatic memberGetEvaluatedItemIncludeEscaped(ProjectItemDefinition)Gets the evaluated, escaped value of the Include attribute of the provided item definition.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetItemsGets all the items in the project of the given item type. If there are none, returns an empty list. Use AddItem or RemoveItem to modify items in this project.
Public methodGetItemsByEvaluatedIncludeGets all items that have the given evaluated Include attribute.
Public methodGetItemsIgnoringConditionGets all the items in the project of the given type, whether or not their Condition attribute evaluates to true. This is a read-only list: use AddItem or RemoveItem to modify items in this project.
Public methodGetLogicalProjectGets an enumerator over all the elements in the "logical project". The logical project is defined as the unevaluated project obtained from the single MSBuild file that is the result of inlining the text of all imports of the original MSBuild project manifest file.
Public methodStatic memberGetMetadataValueEscaped(ProjectMetadata)Gets the escaped value of the provided metadatum.
Public methodStatic memberGetMetadataValueEscaped(ProjectItem, String)Gets the escaped value of the metadatum with the provided name on the provided item.
Public methodStatic memberGetMetadataValueEscaped(ProjectItemDefinition, String)Gets the escaped value of the metadatum with the provided name on the provided item definition.
Public methodGetPropertyGets any property in the project that has the specified name.
Public methodGetPropertyValueGets the value of the given property in this project.
Public methodStatic memberGetPropertyValueEscapedGet the escaped value of the provided property.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodMarkDirtyMarks this project as modified.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodReevaluateIfNecessaryReevaluates the project to incorporate any changes.
Public methodRemoveGlobalPropertyRemoves a global property and marks the project as modified.
Public methodRemoveItemRemoves an item from the project. The item to be removed must be present in the project, and must not originate from an imported file.
Public methodRemoveItemsRemoves all the given items from the project, unless they originate from an imported project.
Public methodRemovePropertyRemoves an property from the project. The property to be removed must be present in the project, and must not originate from an imported file.
Public methodSave()Saves the project to the file system, if modified, using the default character encoding.
Public methodSave(Encoding)Saves the project to the file system, if modified, using the given character encoding.
Public methodSave(String)Saves the project to the file system, if modified or if the path to the project source code changes, using the default character encoding.
Public methodSave(TextWriter)Saves the project to the provided text writer, whether or not the project has been modified. Uses the character encoding of the text writer and marks the project as unmodified.
Public methodSave(String, Encoding)Saves the project to the file system, if modified or if the path to the project source code changes, using the given character encoding.
Public methodSaveLogicalProjectSaves a "logical" or "preprocessed" project file, that includes all the imported files as if they formed a single file.
Public methodSetGlobalPropertySets a global property after the project has been evaluated. If the value changes, the project is marked to require reevaluation.
Public methodSetPropertySets or adds a property with the given name and value to the project. Overwrites the value of a property with the same name if it did not originate in an imported file.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

.NET Framework

Supported in: 4.5, 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