ProjectCollection 類別

定義

封裝一組相關的專案、其工具組、預設的全域屬性集,以及應該用於建置這些項目的記錄器。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
繼承
ProjectCollection
實作

備註

應用程式域內可以有多個專案集合。Multiple project collections can exist within an app domain. 不過,這些不能同時建立。However, these must not build concurrently.

建構函式

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>)

執行個體化專案集合,而該專案集合包含指定的全域屬性、不含記錄器,而且從組態檔和登錄讀取工具組資訊。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)

建立包含指定之全域屬性、記錄器、節點計數及 onlyLogCriticalEvents 值的專案集合。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)

執行個體化專案集合,而該專案集合包含指定的全域屬性和記錄器,而且使用指定的工具組位置。Instantiates a project collection with specified global properties and loggers and using the specified toolset locations.

ProjectCollection(ToolsetDefinitionLocations)

建立不含全域屬性或記錄器的專案集合。Creates a project collection with no global properties or loggers. 專案集合工具組會從所指定位置的工具組初始化。The project collection toolset is initialized from toolsets in the given locations.

屬性

Count

取得目前已載入此集合中的專案數目。Gets the number of projects currently loaded into this collection.

DefaultToolsVersion

取得此專案集合的預設工具版本。Gets the default tools version of this project collection.

DisableMarkDirty

取得或設定旗標,這個旗標會判斷 MarkDirty() 是否暫時在此集合中的專案上停用。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

取得全域專案集合物件。Gets the global project collection object.

GlobalProperties

為此集合中的所有專案取得唯讀的預設全域屬性。Gets the read-only default global properties for all projects in this collection.

HostServices

取得或設定物件,這個物件會在專案集合內含專案的建置期間為工作提供主機服務。Gets or sets an object that provides host services to tasks during builds of projects contained in the project collection.

IsBuildEnabled

取得或設定值,指出是否可以建置專案集合中的專案目標和工作。Gets or sets a value that indicates whether the targets and tasks of projects in the project collection can be built.

LoadedProjects

取得目前已載入這個集合中的所有專案。Gets all the projects currently loaded into this collection.

Loggers

取得所有可讓這個集合中的專案用於進行建置的記錄器。Gets all loggers that projects in this collection can use for their builds.

OnlyLogCriticalEvents

取得或設定值,指出是否只會記錄重大事件,例如警告或錯誤。Gets or sets a value that indicates whether only critical events such as warnings and errors are logged.

SkipEvaluation

取得或設定值,指出 ReevaluateIfNecessary 是否暫時在此集合中的專案上停用。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

取得用於尋找工具組的位置。Gets the locations used to find the toolsets.

Toolsets

取得此專案集合可用的工具組。Gets the toolsets available to this project collection.

Version

取得包含 MSBuild 引擎之組件檔的檔案版本。Gets the file version of the assembly file that contains the MSBuild engine.

方法

AddToolset(Toolset)

將新工具組加入至專案集合中。Adds a new toolset to the project collection. 取代具有相同工具版本的任何現有工具組。Replaces any existing toolset with the same tools version.

ContainsToolset(String)

判斷已針對指定的工具版本定義工具組。Determines whether a toolset is defined for the given tools version.

Dispose()

釋放 Managed 和 Unmanaged 兩種資源。Releases both managed and unmanaged resources. 當主機不再需要專案集合時予以呼叫。Called when a host no longer needs the project collection.

Dispose(Boolean)

釋放 Managed 和 Unmanaged 兩種資源。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)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
Escape(String)

將字串中的特殊字元轉換成 MSBuild 逸出格式。Converts special characters in a string to MSBuild escape format.

GetGlobalProperty(String)

在具有指定名稱的專案集合上取得任何全域屬性。Gets any global property on the project collection that has the specified name.

GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetLoadedProjects(String)

取得所有具有與所指定路徑相符之專案路徑的專案。Gets all projects whose project path matches the given path.

GetToolset(String)

取得具有指定工具版本的工具組。Gets the toolset with the specified tools version.

GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
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)

從讀取自指定之專案檔的原始程式碼評估專案。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)

從讀取自指定之專案檔的原始程式碼評估專案。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)

從指定之 XML 讀取器讀取的原始程式碼評估專案。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)

從指定之 XML 讀取器讀取的原始程式碼評估專案。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)

從指定之 XML 讀取器讀取的原始程式碼評估專案。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()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
RegisterForwardingLoggers(IEnumerable<ForwardingLoggerRecord>)

將指定的遠端記錄器加入至遠端記錄器集合,而該遠端記錄器集合用於建置此集合中的專案。Adds the given remote loggers to the collection of remote loggers used for builds of projects in this collection.

RegisterLogger(ILogger)

將指定的記錄器加入至記錄器集合,而該記錄器集合用於建置此集合中的專案。Adds the given logger to the collection of loggers used for builds of projects in this collection.

RegisterLoggers(IEnumerable<ILogger>)

將指定的記錄器加入至記錄器集合,而該記錄器集合用於建置此集合中的專案。Adds the given loggers to the collection of loggers used for builds of projects in this collection.

RemoveAllToolsets()

從專案集合中移除所有工具組。Removes all toolsets from the project collection.

RemoveGlobalProperty(String)

從預設全域屬性集中移除全域屬性。Removes a global property from the set of default global properties.

RemoveToolset(String)

從專案集合中移除工具組。Removes a toolset from the project collection.

SetGlobalProperty(String, String)

設定預設全域屬性集中之屬性的值。Sets the value of a property in the default set of global properties.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
TryUnloadProject(ProjectRootElement)

嘗試從集合中移除專案。Attempts to remove a project from the collection.

Unescape(String)

將字串中的逸出字元轉換成具有特別意義的 MSBuild 字元。Converts escaped characters in a string to MSBuild characters with special meaning.

UnloadAllProjects()

移除此專案集合中的所有專案。Removes all projects in this project collection.

UnloadProject(Project)

從專案集合中移除指定的專案。Removes the given project from the project collection.

UnloadProject(ProjectRootElement)

從專案根項目快取中移除專案根項目。Removes a project root element from the project root cache.

UnregisterAllLoggers()

從記錄器集合中移除所有記錄器,而此集合中的專案建置會使用該記錄器集合。Removes all loggers from the collection of loggers used by project builds in this collection.

事件

ProjectAdded

在專案加入至這個專案集合的 ProjectRootElementCache 時引發的事件。Event that is fired when a project is added to the ProjectRootElementCache of this project collection.

ProjectChanged

直接變更此執行個體包含的 Project 時引發。Raised when a Project contained by this instance is directly changed.

ProjectCollectionChanged

此執行個體的狀態變更時引發。Raised when state is changed on this instance.

ProjectXmlChanged

變更此執行個體包含的 ProjectRootElement 時引發。Raised when a ProjectRootElement contained by this instance is changed.

適用於