Home All Groups Group Topic Archive Search About

Prevent framework 2.0 - when called through COM

Author
2 Feb 2006 1:27 PM
Thomas Andersen
I have a .net program written in 1.1, that doesn't work in .net 2.2.

We use it from a non-dotnet application, so it is called through a COM
interface.
The problem is that when it is called through the COM interface, it runs in
2.0 and fails.

How do I prevent that?

--
Best regards,
  Thomas Andersen

Author
2 Feb 2006 6:12 PM
Cowboy (Gregory A. Beamer) - MVP
Off the top of my head: Set it up as an app so you can add a config. Set the
config to require runtime 1.1.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************


Show quote
"Thomas Andersen" wrote:

> I have a .net program written in 1.1, that doesn't work in .net 2.2.
>
> We use it from a non-dotnet application, so it is called through a COM
> interface.
> The problem is that when it is called through the COM interface, it runs in
> 2.0 and fails.
>
> How do I prevent that?
>
> --
> Best regards,
>   Thomas Andersen
>
>
>
Author
2 Feb 2006 11:46 PM
Huihong
In your non .NET program, you can first bind to a specific version of
..NET Framework using the unmanaged hosting api, e.g.,

ICorRuntimeHost* spRuntimeHost = NULL;
HRESULT hr = CorBindToRuntimeEx(
L"v1.1.4322",
L"wks",    //Request a WorkStation build of the CLR
STARTUP_CONCURRENT_GC,
STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN,
CLSID_CorRuntimeHost,
IID_ICorRuntimeHost,
(void**)&spRuntimeHost
);
if (SUCCEEDED(hr))
   hr = spRuntimeHost->Start();

This will force v1.1.4322 to be loaded. Make sure you do this before
any other .NET stuff coming up. I have used this on remotesoft tools,
and it work well for us.

Huihong
http://www.remotesoft.com
The best possible ways to secure .NET Code from decompilation

AddThis Social Bookmark Button