ProjectCollection.LoadProject 方法

定义

利用给定的项目文件中的源代码计算一个项目。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(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(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(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.

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(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, 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.

注解

在随 .NET Framework 4.5 和 Visual Studio 12.0 一起提供的 MSBuild 版本中,必须在 ProjectCollection 超出范围之前调用 UnloadProject。In the MSBuild versions that were delivered with .NET Framework 4.5 and Visual Studio 12.0, you must call UnloadProject before the ProjectCollection goes out of scope.

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.

public:
 Microsoft::Build::Evaluation::Project ^ LoadProject(System::Xml::XmlReader ^ xmlReader, System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^ globalProperties, System::String ^ toolsVersion);
public Microsoft.Build.Evaluation.Project LoadProject (System.Xml.XmlReader xmlReader, System.Collections.Generic.IDictionary<string,string> globalProperties, string toolsVersion);
member this.LoadProject : System.Xml.XmlReader * System.Collections.Generic.IDictionary<string, string> * string -> Microsoft.Build.Evaluation.Project

参数

xmlReader
XmlReader

从中读取项目的 Xml 读取器。Xml reader to read project from

globalProperties
IDictionary<String,String>

要使用的全局属性。The global properties to use. 可以为 null,在此情况下,将使用包含项目集合的全局属性。May be null in which case the containing project collection's global properties will be used.

toolsVersion
String

工具版本。The tools version. 可为 null。May be null.

返回

新项目。The new project.

注解

如果为此项目或给定的项目根指定了项目文件的完整路径,则会将项目添加到此项目集合。The project is added to this project collection when either this project or the given project root is given the full path to a project file.

在随 .NET Framework 4.5 和 Visual Studio 12.0 一起提供的 MSBuild 版本中,必须在 ProjectCollection 超出范围之前调用 UnloadProject。In the MSBuild versions that were delivered with .NET Framework 4.5 and Visual Studio 12.0, you must call UnloadProject before the ProjectCollection goes out of scope.

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.

public:
 Microsoft::Build::Evaluation::Project ^ LoadProject(System::String ^ fileName, System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^ globalProperties, System::String ^ toolsVersion);
public Microsoft.Build.Evaluation.Project LoadProject (string fileName, System.Collections.Generic.IDictionary<string,string> globalProperties, string toolsVersion);
member this.LoadProject : string * System.Collections.Generic.IDictionary<string, string> * string -> Microsoft.Build.Evaluation.Project
Public Function LoadProject (fileName As String, globalProperties As IDictionary(Of String, String), toolsVersion As String) As Project

参数

fileName
String

要计算的项目文件。The project file to be evaluated.

globalProperties
IDictionary<String,String>

要使用的全局属性。The global properties to use. 可能为 null,在此情况下,将使用包含项目集合的全局属性。May be null, in which case the containing project collection's global properties will be used.

toolsVersion
String

工具版本。The tools version. 可为 null。May be null.

返回

如果已经利用给定的项目文件以及给定的全局属性和工具版本计算集合中的一个现有项目,则返回该现有项目。If an existing project in the collection has already been evaluated from the given project file, and with the given global properties and tools version, then the existing project is returned. 否则,将创建并计算一个新项目,将其添加到项目集合中,然后返回此项目。Otherwise, a new project is created, evaluated, added to the project collection, and returned.

注解

在随 .NET Framework 4.5 和 Visual Studio 12.0 一起提供的 MSBuild 版本中,必须在 ProjectCollection 超出范围之前调用 UnloadProject。In the MSBuild versions that were delivered with .NET Framework 4.5 and Visual Studio 12.0, you must call UnloadProject before the ProjectCollection goes out of scope.

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.

public:
 Microsoft::Build::Evaluation::Project ^ LoadProject(System::Xml::XmlReader ^ xmlReader, System::String ^ toolsVersion);
public Microsoft.Build.Evaluation.Project LoadProject (System.Xml.XmlReader xmlReader, string toolsVersion);
member this.LoadProject : System.Xml.XmlReader * string -> Microsoft.Build.Evaluation.Project

参数

xmlReader
XmlReader

从中读取项目源代码的 Xml 读取器。Xml reader to read project source code from.

toolsVersion
String

要使用的工具版本。The tools version to use. 可为 null。May be null.

返回

新项目。The new project.

注解

如果为此项目或给定的项目根指定了项目文件的完整路径,则会将项目添加到此项目集合。The project is added to this project collection when either this project or the given project root is given the full path to a project file.

在随 .NET Framework 4.5 和 Visual Studio 12.0 一起提供的 MSBuild 版本中,必须在 ProjectCollection 超出范围之前调用 UnloadProject。In the MSBuild versions that were delivered with .NET Framework 4.5 and Visual Studio 12.0, you must call UnloadProject before the ProjectCollection goes out of scope.

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.

public:
 Microsoft::Build::Evaluation::Project ^ LoadProject(System::Xml::XmlReader ^ xmlReader);
public Microsoft.Build.Evaluation.Project LoadProject (System.Xml.XmlReader xmlReader);
member this.LoadProject : System.Xml.XmlReader -> Microsoft.Build.Evaluation.Project

参数

xmlReader
XmlReader

从中读取项目源代码的 Xml 读取器。Xml reader to read project source code from.

返回

新项目。The new project.

注解

如果为此项目或给定的项目根指定了项目文件的完整路径,则会将项目添加到此项目集合。The project is added to this project collection when either this project or the given project root is given the full path to a project file.

在随 .NET Framework 4.5 和 Visual Studio 12.0 一起提供的 MSBuild 版本中,必须在 ProjectCollection 超出范围之前调用 UnloadProject。In the MSBuild versions that were delivered with .NET Framework 4.5 and Visual Studio 12.0, you must call UnloadProject before the ProjectCollection goes out of scope.

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.

public:
 Microsoft::Build::Evaluation::Project ^ LoadProject(System::String ^ fileName);
public Microsoft.Build.Evaluation.Project LoadProject (string fileName);
member this.LoadProject : string -> Microsoft.Build.Evaluation.Project
Public Function LoadProject (fileName As String) As Project

参数

fileName
String

要计算的项目文件。The project file to evaluate.

返回

如果已经利用给定的项目文件计算集合中的一个现有项目,则返回该现有项目。If an existing project in the collection has already been evaluated from the given project file, the existing project is returned. 否则,将创建并计算一个新项目,将其添加到项目集合中,然后返回此项目。Otherwise, a new project is created, evaluated, added to the project collection, and returned.

注解

在随 .NET Framework 4.5 和 Visual Studio 12.0 一起提供的 MSBuild 版本中,必须在 ProjectCollection 超出范围之前调用 UnloadProject。In the MSBuild versions that were delivered with .NET Framework 4.5 and Visual Studio 12.0, you must call UnloadProject before the ProjectCollection goes out of scope.

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.

public:
 Microsoft::Build::Evaluation::Project ^ LoadProject(System::String ^ fileName, System::String ^ toolsVersion);
public Microsoft.Build.Evaluation.Project LoadProject (string fileName, string toolsVersion);
member this.LoadProject : string * string -> Microsoft.Build.Evaluation.Project
Public Function LoadProject (fileName As String, toolsVersion As String) As Project

参数

fileName
String

要计算的项目文件。The project file to evaluate.

toolsVersion
String

要使用的工具版本。The tools version to use. 可为 null。May be null.

返回

如果已经利用给定的项目文件和给定的工具版本计算集合中的一个现有项目,则返回该现有项目。If an existing project in the collection has already been evaluated from the given project file, and with the given tools version, then the existing project is returned. 否则,将创建并计算一个新项目,将其添加到项目集合中,然后返回此项目。Otherwise, a new project is created, evaluated, added to the project collection, and returned.

注解

在随 .NET Framework 4.5 和 Visual Studio 12.0 一起提供的 MSBuild 版本中,必须在 ProjectCollection 超出范围之前调用 UnloadProject。In the MSBuild versions that were delivered with .NET Framework 4.5 and Visual Studio 12.0, you must call UnloadProject before the ProjectCollection goes out of scope.

适用于