ProjectInstance ProjectInstance ProjectInstance ProjectInstance Class

Definition

Represents a project instance.

public ref class ProjectInstance
public class ProjectInstance
type ProjectInstance = class
Public Class ProjectInstance
Inheritance
ProjectInstanceProjectInstanceProjectInstanceProjectInstance

Remarks

Instances of this class result when a project is cloned. Constructors are internal in order to require users to create project instances from existing projects.

New project instances are immutable, except that instance items can be added to them and instance properties set on them. Project instances are useful because they can be modified and built several times without disturbing the original project.

Neither this class nor any of its constituents is allowed to have references to Microsoft.Build.Construction or Microsoft.Build.Evaluation objects.

Project instance targets, host services, and the task registry are not exposed.

Constructors

ProjectInstance(ProjectRootElement) ProjectInstance(ProjectRootElement) ProjectInstance(ProjectRootElement) ProjectInstance(ProjectRootElement)

Creates a new project instance and initializes it from the given project root, using the default project collection.

ProjectInstance(ProjectRootElement, IDictionary<String,String>, String, ProjectCollection) ProjectInstance(ProjectRootElement, IDictionary<String,String>, String, ProjectCollection) ProjectInstance(ProjectRootElement, IDictionary<String,String>, String, ProjectCollection) ProjectInstance(ProjectRootElement, IDictionary<String,String>, String, ProjectCollection)

Creates a new project instance and initializes it from the given project root, using the given global properties, tools version, and project collection.

ProjectInstance(ProjectRootElement, IDictionary<String,String>, String, String, ProjectCollection) ProjectInstance(ProjectRootElement, IDictionary<String,String>, String, String, ProjectCollection) ProjectInstance(ProjectRootElement, IDictionary<String,String>, String, String, ProjectCollection) ProjectInstance(ProjectRootElement, IDictionary<String,String>, String, String, ProjectCollection)

Creates a new project instance and initializes it from the given project root, using the given global properties, tools version, and project collection

ProjectInstance(String) ProjectInstance(String) ProjectInstance(String) ProjectInstance(String)

Creates a new project instance and initializes it from the given project file, using the default project collection.

ProjectInstance(String, IDictionary<String,String>, String) ProjectInstance(String, IDictionary<String,String>, String) ProjectInstance(String, IDictionary<String,String>, String) ProjectInstance(String, IDictionary<String,String>, String)

Creates a new project instance and initializes it from the given project file, using the given global properties, tools version, and the default project collection.

ProjectInstance(String, IDictionary<String,String>, String, ProjectCollection) ProjectInstance(String, IDictionary<String,String>, String, ProjectCollection) ProjectInstance(String, IDictionary<String,String>, String, ProjectCollection) ProjectInstance(String, IDictionary<String,String>, String, ProjectCollection)

Creates a new project instance and initializes it from the given project file, using the given global properties, tools version, and project collection.

ProjectInstance(String, IDictionary<String,String>, String, String, ProjectCollection) ProjectInstance(String, IDictionary<String,String>, String, String, ProjectCollection) ProjectInstance(String, IDictionary<String,String>, String, String, ProjectCollection) ProjectInstance(String, IDictionary<String,String>, String, String, ProjectCollection)

Creates a new project instance and initializes it from the given project file, using the given global properties, tools version, sub toolset version, and project collection.

Properties

DefaultTargets DefaultTargets DefaultTargets DefaultTargets

Gets or sets the list of default targets for this project.

Directory Directory Directory Directory

Gets the project root directory. Used for evaluation of relative paths and setting the current directory during build. Is never null: projects not loaded from disk use the current directory from the time the build started.

FullPath FullPath FullPath FullPath

Gets the full path to the project file. Used for logging.

GlobalProperties GlobalProperties GlobalProperties GlobalProperties

Gets the dictionary of global properties this project was evaluated with, if any.

InitialTargets InitialTargets InitialTargets InitialTargets

Gets the list of initial targets for the project and all its imports, depth-first. These targets are built before any other targets.

IsImmutable IsImmutable IsImmutable IsImmutable

Gets a value that indicates whether the project instance is immutable. This flag is set permanently when the instance is created.

ItemDefinitions ItemDefinitions ItemDefinitions ItemDefinitions

Gets a read-only dictionary of the item definitions in the project, keyed by item type.

Items Items Items Items

Gets all items in this project.

ItemTypes ItemTypes ItemTypes ItemTypes

Gets all item types in this project.

ProjectFileLocation ProjectFileLocation ProjectFileLocation ProjectFileLocation

Gets the location of the originating file itself. Never null.

Properties Properties Properties Properties

Gets all properties in this project.

Targets Targets Targets Targets

Gets an enumerator over all targets in this project. This collection is read-only.

ToolsVersion ToolsVersion ToolsVersion ToolsVersion

Gets the tools version this project was evaluated with, if any.

Methods

AddItem(String, String) AddItem(String, String) AddItem(String, String) AddItem(String, String)

Adds an item with no metadata to the project.

AddItem(String, String, IEnumerable<KeyValuePair<String,String>>) AddItem(String, String, IEnumerable<KeyValuePair<String,String>>) AddItem(String, String, IEnumerable<KeyValuePair<String,String>>) AddItem(String, String, IEnumerable<KeyValuePair<String,String>>)

Adds an item with the given metadata to the project.

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

Builds the default targets of the project with loggers of the project collection.

Build(IEnumerable<ILogger>) Build(IEnumerable<ILogger>) Build(IEnumerable<ILogger>) Build(IEnumerable<ILogger>)

Builds the default targets of the project with the given loggers.

Build(IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>) Build(IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>) Build(IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>) Build(IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>)

Builds the default targets of the project with the given loggers and remote loggers.

Build(String, IEnumerable<ILogger>) Build(String, IEnumerable<ILogger>) Build(String, IEnumerable<ILogger>) Build(String, IEnumerable<ILogger>)

Builds the given target of the project with the given loggers.

Build(String, IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>) Build(String, IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>) Build(String, IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>) Build(String, IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>)

Builds the given target of the project with the given loggers and remote loggers.

Build(String[], IEnumerable<ILogger>) Build(String[], IEnumerable<ILogger>) Build(String[], IEnumerable<ILogger>) Build(String[], IEnumerable<ILogger>)

Builds the given targets of the project with the given loggers.

Build(String[], IEnumerable<ILogger>, IDictionary<String,TargetResult>) Build(String[], IEnumerable<ILogger>, IDictionary<String,TargetResult>) Build(String[], IEnumerable<ILogger>, IDictionary<String,TargetResult>) Build(String[], IEnumerable<ILogger>, IDictionary<String,TargetResult>)

Build a list of targets with specified loggers. Targets may be null. Loggers may be null.

Build(String[], IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>) Build(String[], IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>) Build(String[], IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>) Build(String[], IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>)

Builds the given targets of the project with the given loggers and remote loggers.

Build(String[], IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>, IDictionary<String,TargetResult>) Build(String[], IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>, IDictionary<String,TargetResult>) Build(String[], IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>, IDictionary<String,TargetResult>) Build(String[], IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>, IDictionary<String,TargetResult>)

Builds the given targets with the given target outputs and with the given loggers and remote loggers.

DeepCopy() DeepCopy() DeepCopy() DeepCopy()

Creates an independent, deep clone of this project and everything in it. Clone has the same mutability as the original. Useful for compiling a single file or for keeping build results between builds.

DeepCopy(Boolean) DeepCopy(Boolean) DeepCopy(Boolean) DeepCopy(Boolean)

Creates an independent, deep clone of this project and everything in it, with specified mutability. Useful for compiling a single file or for keeping build results between builds.

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

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

(Inherited from Object)
EvaluateCondition(String) EvaluateCondition(String) EvaluateCondition(String) EvaluateCondition(String)

Evaluates the provided string as a condition by expanding items and properties, using the current items and properties available, then doing a logical evaluation.

ExpandString(String) ExpandString(String) ExpandString(String) ExpandString(String)

Evaluates the provided string by expanding items and properties, using the current items and properties available.

GetEvaluatedItemIncludeEscaped(ProjectItemDefinitionInstance) GetEvaluatedItemIncludeEscaped(ProjectItemDefinitionInstance) GetEvaluatedItemIncludeEscaped(ProjectItemDefinitionInstance) GetEvaluatedItemIncludeEscaped(ProjectItemDefinitionInstance)

Gets the evaluated, escaped value of the Include attribute of the provided item definition.

GetEvaluatedItemIncludeEscaped(ProjectItemInstance) GetEvaluatedItemIncludeEscaped(ProjectItemInstance) GetEvaluatedItemIncludeEscaped(ProjectItemInstance) GetEvaluatedItemIncludeEscaped(ProjectItemInstance)

Gets the evaluated, escaped value of the Include attribute of the provided item.

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

Serves as the default hash function.

(Inherited from Object)
GetItems(String) GetItems(String) GetItems(String) GetItems(String)

Gets all the items in this project of the specified type. This is a read-only list.

GetItemsByItemTypeAndEvaluatedInclude(String, String) GetItemsByItemTypeAndEvaluatedInclude(String, String) GetItemsByItemTypeAndEvaluatedInclude(String, String) GetItemsByItemTypeAndEvaluatedInclude(String, String)

Gets all the items in this project of the specified type and evaluated include value. This is a read-only list.

GetMetadataValueEscaped(ProjectItemDefinitionInstance, String) GetMetadataValueEscaped(ProjectItemDefinitionInstance, String) GetMetadataValueEscaped(ProjectItemDefinitionInstance, String) GetMetadataValueEscaped(ProjectItemDefinitionInstance, String)

Gets the escaped value of the metadatum with the provided name of the provided item definition.

GetMetadataValueEscaped(ProjectItemInstance, String) GetMetadataValueEscaped(ProjectItemInstance, String) GetMetadataValueEscaped(ProjectItemInstance, String) GetMetadataValueEscaped(ProjectItemInstance, String)

Gets the escaped value of the metadatum with the provided name on the provided item.

GetMetadataValueEscaped(ProjectMetadataInstance) GetMetadataValueEscaped(ProjectMetadataInstance) GetMetadataValueEscaped(ProjectMetadataInstance) GetMetadataValueEscaped(ProjectMetadataInstance)

Gets the escaped value of the provided metadatum.

GetProperty(String) GetProperty(String) GetProperty(String) GetProperty(String)

Gets the property with the given name.

GetPropertyValue(String) GetPropertyValue(String) GetPropertyValue(String) GetPropertyValue(String)

Gets the value of the property with the given name.

GetPropertyValueEscaped(ProjectPropertyInstance) GetPropertyValueEscaped(ProjectPropertyInstance) GetPropertyValueEscaped(ProjectPropertyInstance) GetPropertyValueEscaped(ProjectPropertyInstance)

Gets the escaped value of the provided property.

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

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
RemoveItem(ProjectItemInstance) RemoveItem(ProjectItemInstance) RemoveItem(ProjectItemInstance) RemoveItem(ProjectItemInstance)

Removes an item from the project, if present. Returns true if it was present, false otherwise.

RemoveProperty(String) RemoveProperty(String) RemoveProperty(String) RemoveProperty(String)

Removes a property with the given name. Returns true if the property had a value (possibly empty string), otherwise false.

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

Add a property with the specified name and value to the project. Overwrites any property with the same name already in the property collection.

ToProjectRootElement() ToProjectRootElement() ToProjectRootElement() ToProjectRootElement()

Creates a ProjectRootElement from the contents of this ProjectInstance.

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

Returns a string that represents the current object.

(Inherited from Object)
UpdateStateFrom(ProjectInstance) UpdateStateFrom(ProjectInstance) UpdateStateFrom(ProjectInstance) UpdateStateFrom(ProjectInstance)

Replaces the project state GlobalProperties, Properties and Items with those from the specified ProjectInstance.

Applies to