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
);

Parameters

  • pwzVersion
    [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.

    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.

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

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

Return Value

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

HRESULT

Description

S_OK

The method completed successfully.

E_POINTER

pwzVersion or ppRuntime is null.

Remarks

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

Requirements

Platforms: See .NET Framework System Requirements.

Header: MetaHost.h

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: 4

See Also

Reference

ICLRMetaHost Interface

Other Resources

.NET Framework 1.0 and 1.1 Hosting Interfaces

.NET Framework 2.0 Hosting Interfaces

.NET Framework 1.1 and 2.0 Hosting Global Static Functions

Hosting (Unmanaged API Reference)