Export (0) Print
Expand All

ProjectCollection Class

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.

System.Object
  Microsoft.Build.Evaluation.ProjectCollection

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

public class ProjectCollection : IDisposable

The ProjectCollection type exposes the following members.

  NameDescription
Public methodProjectCollection()Creates a project collection with no global properties or loggers. The project collection toolset is initialized from the configuration file and registry.
Public methodProjectCollection(IDictionary<String, String>)Instantiates a project collection with specified global properties, no loggers, and that reads toolset information from the configuration file and registry.
Public methodProjectCollection(ToolsetDefinitionLocations)Creates a project collection with no global properties or loggers. The project collection toolset is initialized from toolsets in the given locations.
Public methodProjectCollection(IDictionary<String, String>, IEnumerable<ILogger>, ToolsetDefinitionLocations)Instantiates a project collection with specified global properties and loggers and using the specified toolset locations.
Public methodProjectCollection(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.
Top

  NameDescription
Public propertyCountGets the number of projects currently loaded into this collection.
Public propertyDefaultToolsVersionGets the default tools version of this project collection.
Public propertyDisableMarkDirtyGets 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.
Public propertyStatic memberGlobalProjectCollectionGets the global project collection object.
Public propertyGlobalPropertiesGets the read-only default global properties for all projects in this collection.
Public propertyHostServicesGets or sets an object that provides host services to tasks during builds of projects contained in the project collection.
Public propertyIsBuildEnabledGets or sets a property that selects by default whether the targets and tasks of projects in the project collection can be built.
Public propertyLoadedProjectsGets all the projects currently loaded into this collection.
Public propertyLoggersGets all loggers that projects in this collection can use for their builds.
Public propertyOnlyLogCriticalEventsGets or sets a switch that determines whether only critical events such as warnings and errors are logged.
Public propertySkipEvaluationGets or sets a flag the determines 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.
Public propertyToolsetLocationsGets the locations used to find the toolsets.
Public propertyToolsetsGets the toolsets available to this project collection.
Public propertyStatic memberVersionGets the file version of the assembly file that contains the MSBuild engine.
Top

  NameDescription
Public methodAddToolsetAdds a new toolset to the project collection. Replaces any existing toolset with the same tools version.
Public methodContainsToolsetDetermines whether a toolset is defined for the given tools version.
Public methodDispose()Releases both managed and unmanaged resources. Called when a host no longer needs the project collection.
Protected methodDispose(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.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodStatic memberEscapeConverts special characters in a string to MSBuild escape format.
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 methodGetGlobalPropertyGet any global property on the project collection that has the specified name.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetLoadedProjectsGets all projects whose project path matches the given path.
Public methodGetToolsetGet the toolset with the specified tools version.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodLoadProject(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.
Public methodLoadProject(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.
Public methodLoadProject(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.
Public methodLoadProject(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.
Public methodLoadProject(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.
Public methodLoadProject(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.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodRegisterForwardingLoggersAdds the given remote loggers to the collection of remote loggers used for builds of projects in this collection.
Public methodRegisterLoggerAdds the given logger to the collection of loggers used for builds of projects in this collection.
Public methodRegisterLoggersAdds the given loggers to the collection of loggers used for builds of projects in this collection.
Public methodRemoveAllToolsetsRemoves all toolsets from the project collection.
Public methodRemoveGlobalPropertyRemoves a global property from the set of default global properties.
Public methodRemoveToolsetRemoves a toolset from the project collection.
Public methodSetGlobalPropertySets the value of a property in the default set of global properties.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodTryUnloadProjectAttempts to remove a project from the collection.
Public methodStatic memberUnescapeConverts escaped characters in a string to MSBuild characters with special meaning.
Public methodUnloadAllProjectsRemoves all projects in this project collection.
Public methodUnloadProject(Project)Removes the given project from the project collection.
Public methodUnloadProject(ProjectRootElement)Removes a project root element from the project root cache.
Public methodUnregisterAllLoggersRemoves all loggers from the collection of loggers used by project builds in this collection.
Top

  NameDescription
Public eventProjectAddedEvent that is fired when a project is added to the ProjectRootElementCache of this project collection.
Public eventProjectChangedRaised when a Project contained by this instance is directly changed.
Public eventProjectCollectionChangedRaised when state is changed on this instance.
Public eventProjectXmlChangedRaised when a ProjectRootElement contained by this instance is changed.
Top

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

.NET Framework

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