ICLRMetaHost::GetRuntime Method

.NET Framework (current version)

Gets the ICLRRuntimeInfo interface that corresponds to a particular version of the common language runtime (CLR). This method supersedes the CorBindToRuntimeEx function used with the STARTUP_LOADER_SAFEMODE flag.

HRESULT GetRuntime (  
    [in] LPCWSTR pwzVersion,  
    [in, REFIID riid,  
    [out,iid_is(riid), retval] LPVOID *ppRuntime  


[in] The .NET Framework compilation version stored in the metadata, in the format "vA.B[.X]". A, B, and X are decimal numbers that correspond to the major version, the minor version, and the build number.

System_CAPS_ICON_note.jpg Note

This parameter must match the directory name for the .NET Framework version, as it appears under C:\Windows\Microsoft.NET\Framework or C:\Windows\Microsoft.NET\Framework64.

Example values are "v1.0.3705", "v1.1.4322", "v2.0.50727", and "v4.0.X", where X depends on the build number installed. The "v" prefix is required.

[in] The identifier for the desired interface. Currently, the only valid value for this parameter is IID_ICLRRuntimeInfo.

[out] A pointer to the ICLRRuntimeInfo interface that corresponds to the requested runtime.

This method returns the following specific HRESULTs as well as HRESULT errors that indicate method failure.

S_OKThe method completed successfully.
E_POINTERpwzVersion or ppRuntime is null.

This method interacts consistently with legacy interfaces such as the ICorRuntimeHost interface and legacy functions such as the deprecated CorBindTo* functions (see Deprecated CLR Hosting Functions in the .NET Framework 2.0 hosting API). That is, runtimes that are loaded with the legacy API are visible to the new API, and runtimes that are loaded with the new API are visible to the legacy API. .

Platforms: See System Requirements.

Header: MetaHost.h

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: Available since 4

ICLRMetaHost Interface
Deprecated CLR Hosting Interfaces and Coclasses
CLR Hosting Interfaces
Deprecated CLR Hosting Functions