I use the following unmanaged C ++ code to create a CLR instance from an Excel 2003 add-in (COM padding for a .NET add-in):
hr = CorBindToRuntimeEx(
0, // version, use default
0, // flavor, use default
0, // domain-neutral"ness" and gc settings
CLSID_CorRuntimeHost,
IID_ICorRuntimeHost,
(PVOID*) &m_pHost);
and for the vast majority of machines in our organization (several hundred), this works fine, even those that have several versions of the CLR installed; however, an incorrect (older) version of the CLR is created for several computers, which then cannot load the assembly because it requires the .NET 2 runtime.
Yesterday the first time I launched Process Explorer, and it was pretty revealing, showing the following on one of the problematic machines:
process pid type Handle or DLL
------- --- ---- -------------
procexp.exe 5056 DLL c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorworks.dll
EXCEL.EXE 7180 DLL c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorworks.dll
i.e. An incorrect version of the runtime was loaded in Excel, although a new version is available. Now I need to find out why.
, :
- - "" CLR- , MS (http://msdn.microsoft.com/en-us/library/ms231419.aspx) , , .
- Excel () .NET 1 CLR Excel .
, , , /.
- ? , ?
:
- Windows XP SP3
- Excel 2003 SP3 - Excel .
, Excel .