Compartilhar via


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.

MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.

Inheritance Hierarchy

System.Object
  Microsoft.Build.Evaluation.ProjectCollection

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

Syntax

'Declaration
Public Class ProjectCollection _
    Implements IDisposable
public class ProjectCollection : IDisposable
public ref class ProjectCollection : IDisposable
type ProjectCollection =  
    class 
        interface IDisposable 
    end
public class ProjectCollection implements IDisposable

The ProjectCollection type exposes the following members.

Constructors

  Name Description
Public method ProjectCollection() Creates a project collection with no global properties or loggers. The project collection toolset is initialized from the configuration file and registry.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method 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.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method ProjectCollection(ToolsetDefinitionLocations) Creates a project collection with no global properties or loggers. The project collection toolset is initialized from toolsets in the given locations.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method ProjectCollection(IDictionary<String, String>, IEnumerable<ILogger>, ToolsetDefinitionLocations) Instantiates a project collection with specified global properties and loggers and using the specified toolset locations.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method 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. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.

Top

Properties

  Name Description
Public property Count Gets the number of projects currently loaded into this collection.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public property DefaultToolsVersion Gets the default tools version of this project collection. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public property 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.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public propertyStatic member GlobalProjectCollection Gets the global project collection object. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public property GlobalProperties Gets the read-only default global properties for all projects in this collection. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public property HostServices Gets or sets an object that provides host services to tasks during builds of projects contained in the project collection. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public property IsBuildEnabled Gets or sets a property that selects by default whether the targets and tasks of projects in the project collection can be built.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public property LoadedProjects Gets all the projects currently loaded into this collection.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public property Loggers Gets all loggers that projects in this collection can use for their builds. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public property OnlyLogCriticalEvents Gets or sets a switch that determines whether only critical events such as warnings and errors are logged.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public property SkipEvaluation Gets 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.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public property ToolsetLocations Gets the locations used to find the toolsets.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public property Toolsets Gets the toolsets available to this project collection.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public propertyStatic member Version Gets the file version of the assembly file that contains the MSBuild engine.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.

Top

Methods

  Name Description
Public method AddToolset Adds a new toolset to the project collection. Replaces any existing toolset with the same tools version.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method ContainsToolset Determines whether a toolset is defined for the given tools version.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method Dispose() Releases both managed and unmanaged resources. Called when a host no longer needs the project collection. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Protected method 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.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method Equals (Inherited from Object.)
Public methodStatic member Escape Converts special characters in a string to MSBuild escape format. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Protected method Finalize (Inherited from Object.)
Public method GetEffectiveToolsVersion Figure out what ToolsVersion is used to actually build the project.
Public method GetGlobalProperty Get any global property on the project collection that has the specified name.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method GetHashCode (Inherited from Object.)
Public method GetLoadedProjects Gets all projects whose project path matches the given path. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method GetToolset Get the toolset with the specified tools version. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method GetType (Inherited from Object.)
Public method 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. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method 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. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method 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. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method 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. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method 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. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method 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. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Protected method MemberwiseClone (Inherited from Object.)
Public method RegisterForwardingLoggers Adds the given remote loggers to the collection of remote loggers used for builds of projects in this collection. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method RegisterLogger Adds the given logger to the collection of loggers used for builds of projects in this collection. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method RegisterLoggers Adds the given loggers to the collection of loggers used for builds of projects in this collection. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method RemoveAllToolsets Removes all toolsets from the project collection.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method RemoveGlobalProperty Removes a global property from the set of default global properties.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method RemoveToolset Removes a toolset from the project collection.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method SetGlobalProperty Sets the value of a property in the default set of global properties.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method ToString (Inherited from Object.)
Public method TryUnloadProject Attempts to remove a project from the collection.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public methodStatic member Unescape Converts escaped characters in a string to MSBuild characters with special meaning. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method UnloadAllProjects Removes all projects in this project collection. MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method UnloadProject(Project) Removes the given project from the project collection.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method UnloadProject(ProjectRootElement) Removes a project root element from the project root cache.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method UnregisterAllLoggers Removes all loggers from the collection of loggers used by project builds in this collection.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.

Top

Events

  Name Description
Public event ProjectAdded Event that is fired when a project is added to the ProjectRootElementCache of this project collection.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public event ProjectChanged Raised when a Project contained by this instance is directly changed.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public event ProjectCollectionChanged Raised when state is changed on this instance.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public event ProjectXmlChanged Raised when a ProjectRootElement contained by this instance is changed.MSBuild is now included in Visual Studio instead of the .NET Framework.You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.

Top

Remarks

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

Thread Safety

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

See Also

Reference

Microsoft.Build.Evaluation Namespace