[Mono-list] replacement for mscoree.dll

Jeroen Janssen japj@xs4all.nl
Tue, 31 Dec 2002 13:07:51 +0100

Guenther Roith wrote:

>I'm using cygwin/mingw, but haven't yet tried to build it. I'll do this
Well, I just tried to build the file with gcc and it doesn't seem to 
like it, maybe you can find out what exactly is 'wrong'.

Anyway, I have been looking at mscoree.dll & surrounding some more (also 
looking at the dotgnu discussions about this).

It might be interesting to see if we can the following to work:

You can have a <yourapp>.exe.config file containing information about 
the required Runtime.
        <requiredRuntime version="v1.0.0.1" safemode="true"/>

Executing an application with this config file will result in the 
message "C:\WINNT\Microsoft.NET\Framework\v1.0.0.1\mscorwks.dll could 
not be loaded".

Now, if you create that dir and put a 'fake' mscorwks.dll (rename the 
mscoree.dll build from my sources) in the directory, then everything 
works ok again (read: mono is used to execute the .NET application).

What happens is that Microsofts mscoree.dll will first look at the 
.config file. The config file tells it to use the runtime 'v1.0.0.1' 
(which doesn't really exists officially, but it's just a way for our 
'runtime' to be used). Next it will load mscorwks.dll and have it 
execute the .NET application.

Now a possible scenario would be to have a mono + a mscorwks.dll 
installed in "C:\WINNT\Microsoft.NET\Framework\"<SOME_VERSION>\.
Where SOME_VERSION is a version that is not being used by Microsoft 
(else we have a conflict with an installed .NET Framework).

Next step would be to have mcs generate executables that don't need a 
.config file to execute through this mechanism (the resulting exe should 
probably contain some kind of reference to a 'SOME_VERSION' runtime, so 
mscoree will select the correct runtime: mono).

I don't know what other things might be needed to get this fully working 
(example: registry settings?)