ICLRMetaHostPolicy Interface

.NET Framework (current version)

Provides the GetRequestedRuntime method, which returns a pointer to a common language runtime (CLR) interface based on a policy criteria, managed assembly, version and configuration file.



ICLRMetaHostPolicy::GetRequestedRuntime Method

Provides a preferred CLR interface based on a policy criteria, managed assembly, version, and configuration file.

You can get a reference to this interface by calling the CLRCreateInstance function as shown in the following code:

ICLRMetaHostPolicy *pMetaHostPolicy = NULL;
HRESULT hr = CLRCreateInstance(CLSID_CLRMetaHostPolicy,
                   IID_ICLRMetaHostPolicy, (LPVOID*)&pMetaHostPolicy);

This interface does not actually load or activate the CLR, but simply returns the preferred CLR version based on the available versions that are installed or loaded.

The .NET Framework 4 hosting API consolidates policies so that hosts with specific needs may use basic functionality without incurring unintended penalties. For example, many of the MSCorEE.dll exports will bind to a specific CLR, although a method might not logically require it. The METAHOST_POLICY_FLAGS enumeration provides binding policies that are common to the majority of hosts.

Platforms: See .NET Framework System Requirements.

Header: MetaHost.h

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: Available since 4