CorBindToCurrentRuntime Function

Loads the common language runtime (CLR) into a process by using version information stored in an XML file. The format of the XML file is modeled after the standard application configuration file. For more information about configuration files, see Configuration File Schema for the .NET Framework.

HRESULT CorBindToCurrentRuntime (
      [in]  LPCWSTR   pwszFileName,
      [in]  REFCLSID  rclsid,
      [in]  REFIID    riid,
      [out] LPVOID    *ppv



[in] The name of an application configuration file that specifies the version of the CLR to load. If the file name is not fully qualified, it is assumed to be in the same directory as the executable making the call.

The version of the runtime to be loaded is described by the version attribute in the <requiredRuntime> Element of the configuration file.

If no version is specified, or if the <requiredRuntime> element cannot be found, the latest version of the CLR that is installed on the machine is loaded.


[in] The CLSID of the coclass that implements the interface that you are looking for. Supported values are CLSID_CorRuntimeHost or NULL.


[in] The IID of the interface you are requesting. Supported values are IID_ICorRuntimeHost or NULL.


[out] The returned interface pointer.

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: MSCorEE.idl

Library: MSCorEE.dll

.NET Framework Version: 2.0, 1.1, 1.0

Community Additions