ProjectCollection ProjectCollection ProjectCollection ProjectCollection Class

Definition

Encapsulates a set of related projects, their toolsets, a default set of global properties, and the loggers that should be used to build them. A global version of this class acts as the default project collection.

public ref class ProjectCollection : IDisposable
public class ProjectCollection : IDisposable
type ProjectCollection = class
    interface IDisposable
Public Class ProjectCollection
Implements IDisposable
Inheritance
ProjectCollectionProjectCollectionProjectCollectionProjectCollection
Implements

Remarks

Multiple project collections can exist within an app domain. However, these must not build concurrently.

Constructors

ProjectCollection() ProjectCollection() ProjectCollection() ProjectCollection()

Creates a project collection with no global properties or loggers. The project collection toolset is initialized from the configuration file and registry.

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

Instantiates a project collection with specified global properties, no loggers, and that reads toolset information from the configuration file and registry.

ProjectCollection(IDictionary<String,String>, IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>, ToolsetDefinitionLocations, Int32, Boolean) ProjectCollection(IDictionary<String,String>, IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>, ToolsetDefinitionLocations, Int32, Boolean) ProjectCollection(IDictionary<String,String>, IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>, ToolsetDefinitionLocations, Int32, Boolean) ProjectCollection(IDictionary<String,String>, IEnumerable<ILogger>, IEnumerable<ForwardingLoggerRecord>, ToolsetDefinitionLocations, Int32, Boolean)

Creates a project collection with specified global properties, loggers, node count, and onlyLogCriticalEvents value. The project collection toolset is initialized from toolsets in the given locations.

ProjectCollection(IDictionary<String,String>, IEnumerable<ILogger>, ToolsetDefinitionLocations) ProjectCollection(IDictionary<String,String>, IEnumerable<ILogger>, ToolsetDefinitionLocations) ProjectCollection(IDictionary<String,String>, IEnumerable<ILogger>, ToolsetDefinitionLocations) ProjectCollection(IDictionary<String,String>, IEnumerable<ILogger>, ToolsetDefinitionLocations)

Instantiates a project collection with specified global properties and loggers and using the specified toolset locations.

ProjectCollection(ToolsetDefinitionLocations) ProjectCollection(ToolsetDefinitionLocations) ProjectCollection(ToolsetDefinitionLocations) ProjectCollection(ToolsetDefinitionLocations)

Creates a project collection with no global properties or loggers. The project collection toolset is initialized from toolsets in the given locations.

Properties

Count Count Count Count

Gets the number of projects currently loaded into this collection.

DefaultToolsVersion DefaultToolsVersion DefaultToolsVersion DefaultToolsVersion

Gets the default tools version of this project collection.

DisableMarkDirty DisableMarkDirty DisableMarkDirty DisableMarkDirty

Gets or sets a flag that determines whether MarkDirty() is temporarily disabled on projects in this collection. This allows, for example, a global properties to be set without projects getting marked dirty for reevaluation as a consequence.

GlobalProjectCollection GlobalProjectCollection GlobalProjectCollection GlobalProjectCollection

Gets the global project collection object.

GlobalProperties GlobalProperties GlobalProperties GlobalProperties

Gets the read-only default global properties for all projects in this collection.

HostServices HostServices HostServices HostServices

Gets or sets an object that provides host services to tasks during builds of projects contained in the project collection.

IsBuildEnabled IsBuildEnabled IsBuildEnabled IsBuildEnabled

Gets or sets a value that indicates whether the targets and tasks of projects in the project collection can be built.

LoadedProjects LoadedProjects LoadedProjects LoadedProjects

Gets all the projects currently loaded into this collection.

Loggers Loggers Loggers Loggers

Gets all loggers that projects in this collection can use for their builds.

OnlyLogCriticalEvents OnlyLogCriticalEvents OnlyLogCriticalEvents OnlyLogCriticalEvents

Gets or sets a value that indicates whether only critical events such as warnings and errors are logged.

SkipEvaluation SkipEvaluation SkipEvaluation SkipEvaluation

Gets or sets a value the indicates whether ReevaluateIfNecessary is temporarily disabled on projects in this collection. This is useful when the host expects to make a number of reads and writes to projects, and wants to temporarily sacrifice correctness for performance.

ToolsetLocations ToolsetLocations ToolsetLocations ToolsetLocations

Gets the locations used to find the toolsets.

Toolsets Toolsets Toolsets Toolsets

Gets the toolsets available to this project collection.

Version Version Version Version

Gets the file version of the assembly file that contains the MSBuild engine.

Methods

AddToolset(Toolset) AddToolset(Toolset) AddToolset(Toolset) AddToolset(Toolset)

Adds a new toolset to the project collection. Replaces any existing toolset with the same tools version.

ContainsToolset(String) ContainsToolset(String) ContainsToolset(String) ContainsToolset(String)

Determines whether a toolset is defined for the given tools version.

Dispose() Dispose() Dispose() Dispose()

Releases both managed and unmanaged resources. Called when a host no longer needs the project collection.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Releases both managed and unmanaged resources. Called when a host no longer needs the project collection. Shuts down any logging services that the project collection owns and releases the logger thread.

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

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

(Inherited from Object)
Escape(String) Escape(String) Escape(String) Escape(String)

Converts special characters in a string to MSBuild escape format.

GetGlobalProperty(String) GetGlobalProperty(String) GetGlobalProperty(String) GetGlobalProperty(String)

Gets any global property on the project collection that has the specified name.

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

Serves as the default hash function.

(Inherited from Object)
GetLoadedProjects(String) GetLoadedProjects(String) GetLoadedProjects(String) GetLoadedProjects(String)

Gets all projects whose project path matches the given path.

GetToolset(String) GetToolset(String) GetToolset(String) GetToolset(String)

Gets the toolset with the specified tools version.

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

Gets the Type of the current instance.

(Inherited from Object)
LoadProject(String) LoadProject(String) LoadProject(String) LoadProject(String)

Evaluates a project from the source code in the given project file. The source code is evaluated with the global properties and tools version of this project collection.

LoadProject(String, IDictionary<String,String>, String) LoadProject(String, IDictionary<String,String>, String) LoadProject(String, IDictionary<String,String>, String) LoadProject(String, IDictionary<String,String>, String)

Evaluates a project from the source code read from the given project file. The source code is evaluated with the given global properties and tools version.

LoadProject(String, String) LoadProject(String, String) LoadProject(String, String) LoadProject(String, String)

Evaluates a project from the source code read from the given project file. The source code is evaluated with the global properties of this project collection and the given tools version.

LoadProject(XmlReader) LoadProject(XmlReader) LoadProject(XmlReader) LoadProject(XmlReader)

Evaluates a project from the source code read from the given XML reader. The source code is evaluated with the global properties and tools version of this project collection.

LoadProject(XmlReader, IDictionary<String,String>, String) LoadProject(XmlReader, IDictionary<String,String>, String) LoadProject(XmlReader, IDictionary<String,String>, String) LoadProject(XmlReader, IDictionary<String,String>, String)

Evaluates a project from the source code read from the given XML reader. The source code is evaluated with the given global properties and tools version.

LoadProject(XmlReader, String) LoadProject(XmlReader, String) LoadProject(XmlReader, String) LoadProject(XmlReader, String)

Evaluates a project from the source code read from the given XML reader. The source code is evaluated with the global properties of this project collection and the given tools version.

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

Creates a shallow copy of the current Object.

(Inherited from Object)
RegisterForwardingLoggers(IEnumerable<ForwardingLoggerRecord>) RegisterForwardingLoggers(IEnumerable<ForwardingLoggerRecord>) RegisterForwardingLoggers(IEnumerable<ForwardingLoggerRecord>) RegisterForwardingLoggers(IEnumerable<ForwardingLoggerRecord>)

Adds the given remote loggers to the collection of remote loggers used for builds of projects in this collection.

RegisterLogger(ILogger) RegisterLogger(ILogger) RegisterLogger(ILogger) RegisterLogger(ILogger)

Adds the given logger to the collection of loggers used for builds of projects in this collection.

RegisterLoggers(IEnumerable<ILogger>) RegisterLoggers(IEnumerable<ILogger>) RegisterLoggers(IEnumerable<ILogger>) RegisterLoggers(IEnumerable<ILogger>)

Adds the given loggers to the collection of loggers used for builds of projects in this collection.

RemoveAllToolsets() RemoveAllToolsets() RemoveAllToolsets() RemoveAllToolsets()

Removes all toolsets from the project collection.

RemoveGlobalProperty(String) RemoveGlobalProperty(String) RemoveGlobalProperty(String) RemoveGlobalProperty(String)

Removes a global property from the set of default global properties.

RemoveToolset(String) RemoveToolset(String) RemoveToolset(String) RemoveToolset(String)

Removes a toolset from the project collection.

SetGlobalProperty(String, String) SetGlobalProperty(String, String) SetGlobalProperty(String, String) SetGlobalProperty(String, String)

Sets the value of a property in the default set of global properties.

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

Returns a string that represents the current object.

(Inherited from Object)
TryUnloadProject(ProjectRootElement) TryUnloadProject(ProjectRootElement) TryUnloadProject(ProjectRootElement) TryUnloadProject(ProjectRootElement)

Attempts to remove a project from the collection.

Unescape(String) Unescape(String) Unescape(String) Unescape(String)

Converts escaped characters in a string to MSBuild characters with special meaning.

UnloadAllProjects() UnloadAllProjects() UnloadAllProjects() UnloadAllProjects()

Removes all projects in this project collection.

UnloadProject(Project) UnloadProject(Project) UnloadProject(Project) UnloadProject(Project)

Removes the given project from the project collection.

UnloadProject(ProjectRootElement) UnloadProject(ProjectRootElement) UnloadProject(ProjectRootElement) UnloadProject(ProjectRootElement)

Removes a project root element from the project root cache.

UnregisterAllLoggers() UnregisterAllLoggers() UnregisterAllLoggers() UnregisterAllLoggers()

Removes all loggers from the collection of loggers used by project builds in this collection.

Events

ProjectAdded ProjectAdded ProjectAdded ProjectAdded

Event that is fired when a project is added to the ProjectRootElementCache of this project collection.

ProjectChanged ProjectChanged ProjectChanged ProjectChanged

Raised when a Project contained by this instance is directly changed.

ProjectCollectionChanged ProjectCollectionChanged ProjectCollectionChanged ProjectCollectionChanged

Raised when state is changed on this instance.

ProjectXmlChanged ProjectXmlChanged ProjectXmlChanged ProjectXmlChanged

Raised when a ProjectRootElement contained by this instance is changed.

Applies to