ProjectRootElement.TryOpen Method (String)
Gets the project root in the global project collection that was loaded into memory from the specified file path. or null if it is not currently in memory.
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.
Namespace: Microsoft.Build.Construction
Assembly: Microsoft.Build (in Microsoft.Build.dll)
Syntax
'Declaration
Public Shared Function TryOpen ( _
path As String _
) As ProjectRootElement
public static ProjectRootElement TryOpen(
string path
)
public:
static ProjectRootElement^ TryOpen(
String^ path
)
static member TryOpen :
path:string -> ProjectRootElement
public static function TryOpen(
path : String
) : ProjectRootElement
Parameters
path
Type: System.StringThe path of the ProjectRootElement, cannot be null.
Return Value
Type: Microsoft.Build.Construction.ProjectRootElement
Returns the project root. Returns null if no project was loaded into memory from the specified file path.
Remarks
It is possible for ProjectRootElements to be brought into memory and discarded due to memory pressure. If TryOpen returns null it does not indicate that the project root has never been loaded, only that it is not currently in memory.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.