![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a .NET Assembly that is configured as an Addin for a 3rd party application via regasm.exe. My addin has worked in .NET 1.1 for over a year now. I loaded .NET 2.0 Framework and pieces of my addin now fail. Using RuntimeEnvironment.GetSystemVersion(), I discovered that my addin is actually running in v2.0.50727 of the framework. mscoree.dll is responsible for loading of the framework runtime. Examining the registry entries created by regasm.exe, you'll see the following. [HKEY_CLASSES_ROOT\CLSID\{35224D40-BEE5-4397-97D1-3FA9A662DB54}\InprocServer |
|
@="mscoree.dll" "ThreadingModel"="Both" "Class"="MyAddin.Addin" "Assembly"="MyAddin, Version=1.0.2167.24515, Culture=neutral, PublicKeyToken=null" "RuntimeVersion"="v1.1.4322" Notice that the RuntimeVersion is specified correctly. So my question is, does mscoree.dll not honor the RuntimeVersion specified by the addin? If the answer is yes, it is possible, can someone please explain to me what I need to do to make this happen. The only alternative at this point that I can think of is using a C++ shim to control the loading of my addin. Very feasible but I'd at least like to know why I am experiencing this problem. Thanks. Jason Newell |
#3
| |||
| |||
|
|
I have a .NET Assembly that is configured as an Addin for a 3rd party application via regasm.exe. My addin has worked in .NET 1.1 for over a year now. I loaded .NET 2.0 Framework and pieces of my addin now fail. Using RuntimeEnvironment.GetSystemVersion(), I discovered that my addin is actually running in v2.0.50727 of the framework. mscoree.dll is responsible for loading of the framework runtime. Examining the registry entries created by regasm.exe, you'll see the following. [HKEY_CLASSES_ROOT\CLSID\{35224D40-BEE5-4397-97D1-3FA9A662DB54}\InprocServer32] @="mscoree.dll" "ThreadingModel"="Both" "Class"="MyAddin.Addin" "Assembly"="MyAddin, Version=1.0.2167.24515, Culture=neutral, PublicKeyToken=null" "RuntimeVersion"="v1.1.4322" Notice that the RuntimeVersion is specified correctly. So my question is, does mscoree.dll not honor the RuntimeVersion specified by the addin? If the answer is yes, it is possible, can someone please explain to me what I need to do to make this happen. The only alternative at this point that I can think of is using a C++ shim to control the loading of my addin. Very feasible but I'd at least like to know why I am experiencing this problem. Thanks. Jason Newell |
#4
| |||
| |||
|
|
I have a .NET Assembly that is configured as an Addin for a 3rd party application via regasm.exe. My addin has worked in .NET 1.1 for over a year now. I loaded .NET 2.0 Framework and pieces of my addin now fail. Using RuntimeEnvironment.GetSystemVersion(), I discovered that my addin is actually running in v2.0.50727 of the framework. mscoree.dll is responsible for loading of the framework runtime. Examining the registry entries created by regasm.exe, you'll see the following. [HKEY_CLASSES_ROOT\CLSID\{35224D40-BEE5-4397-97D1-3FA9A662DB54}\InprocServer32] @="mscoree.dll" "ThreadingModel"="Both" "Class"="MyAddin.Addin" "Assembly"="MyAddin, Version=1.0.2167.24515, Culture=neutral, PublicKeyToken=null" "RuntimeVersion"="v1.1.4322" Notice that the RuntimeVersion is specified correctly. So my question is, does mscoree.dll not honor the RuntimeVersion specified by the addin? If the answer is yes, it is possible, can someone please explain to me what I need to do to make this happen. The only alternative at this point that I can think of is using a C++ shim to control the loading of my addin. Very feasible but I'd at least like to know why I am experiencing this problem. Thanks. Jason Newell |
#5
| |||
| |||
|
|
I have a .NET Assembly that is configured as an Addin for a 3rd party application via regasm.exe. My addin has worked in .NET 1.1 for over a year now. I loaded .NET 2.0 Framework and pieces of my addin now fail. Using RuntimeEnvironment.GetSystemVersion(), I discovered that my addin is actually running in v2.0.50727 of the framework. mscoree.dll is responsible for loading of the framework runtime. Examining the registry entries created by regasm.exe, you'll see the following. [HKEY_CLASSES_ROOT\CLSID\{35224D40-BEE5-4397-97D1-3FA9A662DB54}\InprocServer32] @="mscoree.dll" "ThreadingModel"="Both" "Class"="MyAddin.Addin" "Assembly"="MyAddin, Version=1.0.2167.24515, Culture=neutral, PublicKeyToken=null" "RuntimeVersion"="v1.1.4322" Notice that the RuntimeVersion is specified correctly. So my question is, does mscoree.dll not honor the RuntimeVersion specified by the addin? If the answer is yes, it is possible, can someone please explain to me what I need to do to make this happen. The only alternative at this point that I can think of is using a C++ shim to control the loading of my addin. Very feasible but I'd at least like to know why I am experiencing this problem. Thanks. Jason Newell |
#6
| |||
| |||
|
|
Thanks for your replies. One thing that I've found out is that you can specify the supportedRuntime attribute in the unmanaged hosts .exe.config file as shown below. configuration startup supportedRuntime version="v1.1.4322" / /startup /configuration I found this information here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetdep/html/sidexsidenet.asp This allowed my addin to load into the 1.1 CLR. Not a good long term solution for the unmanaged host though and I'm sure they wouldn't support me messing with their .exe.config file. I cannot dictate which runtime their application supports. This leads me back to the COM Add-in Shim. I've read much about shimming by google'n. I found this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_comshim.asp which is an Office XP Add-in Shim written in C++. I've taken this example and ported it to my 3rd party unmanaged host's COM API instead of using the Office API. The staus on that is the 3rd party unmanaged host is now calling my shim. Now I'm working on getting my shim to load my .NET addin. Make sense? I know, my brain is fried too. Jason Newell Jason Newell wrote: I have a .NET Assembly that is configured as an Addin for a 3rd party application via regasm.exe. My addin has worked in .NET 1.1 for over a year now. I loaded .NET 2.0 Framework and pieces of my addin now fail. Using RuntimeEnvironment.GetSystemVersion(), I discovered that my addin is actually running in v2.0.50727 of the framework. mscoree.dll is responsible for loading of the framework runtime. Examining the registry entries created by regasm.exe, you'll see the following. [HKEY_CLASSES_ROOT\CLSID\{35224D40-BEE5-4397-97D1-3FA9A662DB54}\InprocServer32] @="mscoree.dll" "ThreadingModel"="Both" "Class"="MyAddin.Addin" "Assembly"="MyAddin, Version=1.0.2167.24515, Culture=neutral, PublicKeyToken=null" "RuntimeVersion"="v1.1.4322" Notice that the RuntimeVersion is specified correctly. So my question is, does mscoree.dll not honor the RuntimeVersion specified by the addin? If the answer is yes, it is possible, can someone please explain to me what I need to do to make this happen. The only alternative at this point that I can think of is using a C++ shim to control the loading of my addin. Very feasible but I'd at least like to know why I am experiencing this problem. Thanks. Jason Newell |
#7
| |||
| |||
|
|
I don't believe that works for v2 of the runtime, did you try this?, the page you are refering to talks about v1.0 and v1.1, these are not distinct versions. Willy. "Jason Newell" <nospam (AT) nospam (DOT) com> wrote in message news:%23DXe5SN$FHA.1028 (AT) TK2MSFTNGP11 (DOT) phx.gbl... Thanks for your replies. One thing that I've found out is that you can specify the supportedRuntime attribute in the unmanaged hosts .exe.config file as shown below. configuration startup supportedRuntime version="v1.1.4322" / /startup /configuration I found this information here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetdep/html/sidexsidenet.asp This allowed my addin to load into the 1.1 CLR. Not a good long term solution for the unmanaged host though and I'm sure they wouldn't support me messing with their .exe.config file. I cannot dictate which runtime their application supports. This leads me back to the COM Add-in Shim. I've read much about shimming by google'n. I found this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_comshim.asp which is an Office XP Add-in Shim written in C++. I've taken this example and ported it to my 3rd party unmanaged host's COM API instead of using the Office API. The staus on that is the 3rd party unmanaged host is now calling my shim. Now I'm working on getting my shim to load my .NET addin. Make sense? I know, my brain is fried too. Jason Newell Jason Newell wrote: I have a .NET Assembly that is configured as an Addin for a 3rd party application via regasm.exe. My addin has worked in .NET 1.1 for over a year now. I loaded .NET 2.0 Framework and pieces of my addin now fail. Using RuntimeEnvironment.GetSystemVersion(), I discovered that my addin is actually running in v2.0.50727 of the framework. mscoree.dll is responsible for loading of the framework runtime. Examining the registry entries created by regasm.exe, you'll see the following. [HKEY_CLASSES_ROOT\CLSID\{35224D40-BEE5-4397-97D1-3FA9A662DB54}\InprocServer32] @="mscoree.dll" "ThreadingModel"="Both" "Class"="MyAddin.Addin" "Assembly"="MyAddin, Version=1.0.2167.24515, Culture=neutral, PublicKeyToken=null" "RuntimeVersion"="v1.1.4322" Notice that the RuntimeVersion is specified correctly. So my question is, does mscoree.dll not honor the RuntimeVersion specified by the addin? If the answer is yes, it is possible, can someone please explain to me what I need to do to make this happen. The only alternative at this point that I can think of is using a C++ shim to control the loading of my addin. Very feasible but I'd at least like to know why I am experiencing this problem. Thanks. Jason Newell |
#8
| |||
| |||
|
|
Willy, I didn't have time to work on it over the weekend but I should have an answer this week sometime. The key to the addin shim is hosting your own application domain. They accomplish this in the example by calling CorBindToRuntimeEx() which allows you to specify which version of the CLR to load. I see nothing reading http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/grfuncorbindtoruntimeex.asp that would make me think it wouldn't work if 2.0 is installed. What in particular are you thinking won't work? I might mention that the testing that I have done, I had v1.1 & v2.0 installed and when running the shim example, I was able to call CorBindToRuntimeEx() specifying v1.1 and I got no errors. Thanks Jason Newell Willy Denoyette [MVP] wrote: I don't believe that works for v2 of the runtime, did you try this?, the page you are refering to talks about v1.0 and v1.1, these are not distinct versions. Willy. "Jason Newell" <nospam (AT) nospam (DOT) com> wrote in message news:%23DXe5SN$FHA.1028 (AT) TK2MSFTNGP11 (DOT) phx.gbl... Thanks for your replies. One thing that I've found out is that you can specify the supportedRuntime attribute in the unmanaged hosts .exe.config file as shown below. configuration startup supportedRuntime version="v1.1.4322" / /startup /configuration I found this information here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetdep/html/sidexsidenet.asp This allowed my addin to load into the 1.1 CLR. Not a good long term solution for the unmanaged host though and I'm sure they wouldn't support me messing with their .exe.config file. I cannot dictate which runtime their application supports. This leads me back to the COM Add-in Shim. I've read much about shimming by google'n. I found this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_comshim.asp which is an Office XP Add-in Shim written in C++. I've taken this example and ported it to my 3rd party unmanaged host's COM API instead of using the Office API. The staus on that is the 3rd party unmanaged host is now calling my shim. Now I'm working on getting my shim to load my .NET addin. Make sense? I know, my brain is fried too. Jason Newell Jason Newell wrote: I have a .NET Assembly that is configured as an Addin for a 3rd party application via regasm.exe. My addin has worked in .NET 1.1 for over a year now. I loaded .NET 2.0 Framework and pieces of my addin now fail. Using RuntimeEnvironment.GetSystemVersion(), I discovered that my addin is actually running in v2.0.50727 of the framework. mscoree.dll is responsible for loading of the framework runtime. Examining the registry entries created by regasm.exe, you'll see the following. [HKEY_CLASSES_ROOT\CLSID\{35224D40-BEE5-4397-97D1-3FA9A662DB54}\InprocServer32] @="mscoree.dll" "ThreadingModel"="Both" "Class"="MyAddin.Addin" "Assembly"="MyAddin, Version=1.0.2167.24515, Culture=neutral, PublicKeyToken=null" "RuntimeVersion"="v1.1.4322" Notice that the RuntimeVersion is specified correctly. So my question is, does mscoree.dll not honor the RuntimeVersion specified by the addin? If the answer is yes, it is possible, can someone please explain to me what I need to do to make this happen. The only alternative at this point that I can think of is using a C++ shim to control the loading of my addin. Very feasible but I'd at least like to know why I am experiencing this problem. Thanks. Jason Newell |
#9
| |||
| |||
|
|
An update on this project. Here is what I have installed on my machine. - Windows XP SP2 - .NET Framework v1.1 - .NET Framework v2.0 - Visual Studio .NET 2003 - C# Express 2005 I created a C++ 7.1 COM Shim addin for my 3rd party application and used parts of the C++ Office Shim addin that I needed. When the C++ Addin Shim gets loaded, it loads CLR v1.1, creates an application domain, then loads the real .NET addin. Worked perfect. Here is a small snippet of code that I modified to load a specifc version of the CLR. Notice that I added the szCLRVersion parameter. HRESULT CCLRLoader::LoadCLR(LPCWSTR szCLRVersion) { HRESULT hr = S_OK; // ensure the CLR is only loaded once. if (m_pHost != NULL) return hr; // Load runtime into the process ... hr = CorBindToRuntimeEx(szCLRVersion, 0, STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN | STARTUP_CONCURRENT_GC, CLSID_CorRuntimeHost, IID_ICorRuntimeHost, (PVOID*) &m_pHost); // couldn't load.... if (!SUCCEEDED(hr)) { return hr; } // start CLR return m_pHost->Start(); } Jason Newell Jason Newell wrote: Willy, I didn't have time to work on it over the weekend but I should have an answer this week sometime. The key to the addin shim is hosting your own application domain. They accomplish this in the example by calling CorBindToRuntimeEx() which allows you to specify which version of the CLR to load. I see nothing reading http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/grfuncorbindtoruntimeex.asp that would make me think it wouldn't work if 2.0 is installed. What in particular are you thinking won't work? I might mention that the testing that I have done, I had v1.1 & v2.0 installed and when running the shim example, I was able to call CorBindToRuntimeEx() specifying v1.1 and I got no errors. Thanks Jason Newell Willy Denoyette [MVP] wrote: I don't believe that works for v2 of the runtime, did you try this?, the page you are refering to talks about v1.0 and v1.1, these are not distinct versions. Willy. "Jason Newell" <nospam (AT) nospam (DOT) com> wrote in message news:%23DXe5SN$FHA.1028 (AT) TK2MSFTNGP11 (DOT) phx.gbl... Thanks for your replies. One thing that I've found out is that you can specify the supportedRuntime attribute in the unmanaged hosts .exe.config file as shown below. configuration startup supportedRuntime version="v1.1.4322" / /startup /configuration I found this information here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetdep/html/sidexsidenet.asp This allowed my addin to load into the 1.1 CLR. Not a good long term solution for the unmanaged host though and I'm sure they wouldn't support me messing with their .exe.config file. I cannot dictate which runtime their application supports. This leads me back to the COM Add-in Shim. I've read much about shimming by google'n. I found this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_comshim.asp which is an Office XP Add-in Shim written in C++. I've taken this example and ported it to my 3rd party unmanaged host's COM API instead of using the Office API. The staus on that is the 3rd party unmanaged host is now calling my shim. Now I'm working on getting my shim to load my .NET addin. Make sense? I know, my brain is fried too. Jason Newell Jason Newell wrote: I have a .NET Assembly that is configured as an Addin for a 3rd party application via regasm.exe. My addin has worked in .NET 1.1 for over a year now. I loaded .NET 2.0 Framework and pieces of my addin now fail. Using RuntimeEnvironment.GetSystemVersion(), I discovered that my addin is actually running in v2.0.50727 of the framework. mscoree.dll is responsible for loading of the framework runtime. Examining the registry entries created by regasm.exe, you'll see the following. [HKEY_CLASSES_ROOT\CLSID\{35224D40-BEE5-4397-97D1-3FA9A662DB54}\InprocServer32] @="mscoree.dll" "ThreadingModel"="Both" "Class"="MyAddin.Addin" "Assembly"="MyAddin, Version=1.0.2167.24515, Culture=neutral, PublicKeyToken=null" "RuntimeVersion"="v1.1.4322" Notice that the RuntimeVersion is specified correctly. So my question is, does mscoree.dll not honor the RuntimeVersion specified by the addin? If the answer is yes, it is possible, can someone please explain to me what I need to do to make this happen. The only alternative at this point that I can think of is using a C++ shim to control the loading of my addin. Very feasible but I'd at least like to know why I am experiencing this problem. Thanks. Jason Newell |
#10
| |||
| |||
|
|
This might work for you, but if you also need to load a v2 add-in in the same process it won't work, you can only have one version of the CLR loaded at any time and a v2 add-in needs the v2 CLR. The real solution is to make sure your v1 add-in's do work on v2 of the framework. Willy. "Jason Newell" <nospam (AT) nospam (DOT) com> wrote in message news:OuMFHXLAGHA.436 (AT) TK2MSFTNGP10 (DOT) phx.gbl... An update on this project. Here is what I have installed on my machine. - Windows XP SP2 - .NET Framework v1.1 - .NET Framework v2.0 - Visual Studio .NET 2003 - C# Express 2005 I created a C++ 7.1 COM Shim addin for my 3rd party application and used parts of the C++ Office Shim addin that I needed. When the C++ Addin Shim gets loaded, it loads CLR v1.1, creates an application domain, then loads the real .NET addin. Worked perfect. Here is a small snippet of code that I modified to load a specifc version of the CLR. Notice that I added the szCLRVersion parameter. HRESULT CCLRLoader::LoadCLR(LPCWSTR szCLRVersion) { HRESULT hr = S_OK; // ensure the CLR is only loaded once. if (m_pHost != NULL) return hr; // Load runtime into the process ... hr = CorBindToRuntimeEx(szCLRVersion, 0, STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN | STARTUP_CONCURRENT_GC, CLSID_CorRuntimeHost, IID_ICorRuntimeHost, (PVOID*) &m_pHost); // couldn't load.... if (!SUCCEEDED(hr)) { return hr; } // start CLR return m_pHost->Start(); } Jason Newell Jason Newell wrote: Willy, I didn't have time to work on it over the weekend but I should have an answer this week sometime. The key to the addin shim is hosting your own application domain. They accomplish this in the example by calling CorBindToRuntimeEx() which allows you to specify which version of the CLR to load. I see nothing reading http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/grfuncorbindtoruntimeex.asp that would make me think it wouldn't work if 2.0 is installed. What in particular are you thinking won't work? I might mention that the testing that I have done, I had v1.1 & v2.0 installed and when running the shim example, I was able to call CorBindToRuntimeEx() specifying v1.1 and I got no errors. Thanks Jason Newell Willy Denoyette [MVP] wrote: I don't believe that works for v2 of the runtime, did you try this?, the page you are refering to talks about v1.0 and v1.1, these are not distinct versions. Willy. "Jason Newell" <nospam (AT) nospam (DOT) com> wrote in message news:%23DXe5SN$FHA.1028 (AT) TK2MSFTNGP11 (DOT) phx.gbl... Thanks for your replies. One thing that I've found out is that you can specify the supportedRuntime attribute in the unmanaged hosts .exe.config file as shown below. configuration startup supportedRuntime version="v1.1.4322" / /startup /configuration I found this information here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetdep/html/sidexsidenet.asp This allowed my addin to load into the 1.1 CLR. Not a good long term solution for the unmanaged host though and I'm sure they wouldn't support me messing with their .exe.config file. I cannot dictate which runtime their application supports. This leads me back to the COM Add-in Shim. I've read much about shimming by google'n. I found this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_comshim.asp which is an Office XP Add-in Shim written in C++. I've taken this example and ported it to my 3rd party unmanaged host's COM API instead of using the Office API. The staus on that is the 3rd party unmanaged host is now calling my shim. Now I'm working on getting my shim to load my .NET addin. Make sense? I know, my brain is fried too. Jason Newell Jason Newell wrote: I have a .NET Assembly that is configured as an Addin for a 3rd party application via regasm.exe. My addin has worked in .NET 1.1 for over a year now. I loaded .NET 2.0 Framework and pieces of my addin now fail. Using RuntimeEnvironment.GetSystemVersion(), I discovered that my addin is actually running in v2.0.50727 of the framework. mscoree.dll is responsible for loading of the framework runtime. Examining the registry entries created by regasm.exe, you'll see the following. [HKEY_CLASSES_ROOT\CLSID\{35224D40-BEE5-4397-97D1-3FA9A662DB54}\InprocServer32] @="mscoree.dll" "ThreadingModel"="Both" "Class"="MyAddin.Addin" "Assembly"="MyAddin, Version=1.0.2167.24515, Culture=neutral, PublicKeyToken=null" "RuntimeVersion"="v1.1.4322" Notice that the RuntimeVersion is specified correctly. So my question is, does mscoree.dll not honor the RuntimeVersion specified by the addin? If the answer is yes, it is possible, can someone please explain to me what I need to do to make this happen. The only alternative at this point that I can think of is using a C++ shim to control the loading of my addin. Very feasible but I'd at least like to know why I am experiencing this problem. Thanks. Jason Newell |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |