共用方式為


VCProjectEngine.LoadProject(String) Method

Definition

Loads a project.

public:
 System::Object ^ LoadProject(System::String ^ projectName);
public:
 Platform::Object ^ LoadProject(Platform::String ^ projectName);
winrt::Windows::Foundation::IInspectable LoadProject(std::wstring const & projectName);
[System.Runtime.InteropServices.DispId(214)]
public object LoadProject (string projectName);
[<System.Runtime.InteropServices.DispId(214)>]
abstract member LoadProject : string -> obj
Public Function LoadProject (projectName As String) As Object

Parameters

projectName
String

Required. The project name.

Returns

A VCProject object.

Attributes

Examples

See How to: Compile Example Code for Project Model Extensibility for information about how to compile and run this example.

This method cannot be called from script. It must be called from an application that creates a new instance of the project engine.

' compile with /reference:Microsoft.VisualStudio.VCProjectEngine.dll  
Option Strict Off  
Imports Microsoft.VisualStudio.VCProjectEngine  

Module Module1  
Sub Main()  
Dim Engine As VCProjectEngine  
Dim Proj As VCProject  
Dim Configs, Tools As IVCCollection  
Dim Config As VCConfiguration  
Dim LinkerTool As VCLinkerTool  

Engine = New VCProjectEngineObject()  
Proj = Engine.LoadProject("xx.vcxproj")  

Configs = Proj.Configurations  
Config = Configs.Item(1)  
Tools = Config.Tools  

LinkerTool = Tools.Item("VCLinkerTool")  
System.Console.WriteLine("Current value of ToolName: {0}", LinkerTool.ToolName)  
Engine.RemoveProject("xx.vcxproj")  
End Sub  
End Module  

Applies to