This documentation is archived and is not being maintained.

ICLRMetaHost::GetRuntime Method

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.


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.




The method completed successfully.


pwzVersion 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 .NET Framework 1.1 and 2.0 Hosting Global Static 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 .NET Framework System Requirements.

Header: MetaHost.h

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: 4