bkaiser
bkaiser

Reputation: 657

IKVM.NET: Unable to find mscorlib.dll?

I'm trying to convert a particular .NET dll (System.DirectoryServices) to a Java stub using ikvmstub.exe. I get the following error:

ikvmstub.exe System.DirectoryServices.dll
Error: unable to load assembly 'System.DirectoryServices.dll' as it depends on a higher version of mscorlib than the one currently loaded

I believe the DLL depends on v4.0.30319, which I have. So I ran this command and got the following output:

ikvmstub.exe -nostdlib -r:/c/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll System.DirectoryServices.dll
Error: unable to find mscorlib.dll

The path I gave to mscorlib is definitely correct. For the record, I'm in Git Bash in Windows 7. What can I do to resolve this error?

Upvotes: 0

Views: 817

Answers (1)

bkaiser
bkaiser

Reputation: 657

Still not sure why this was occurring, but I solved it by reading through the IKVM source.

internal void Init(Universe universe, bool nostdlib, IList<string> references, IList<string> userLibPaths)
    {
        this.universe = universe;
        // like the C# compiler, the references are loaded from:
        // current directory, CLR directory, -lib: option, %LIB% environment
        // (note that, unlike the C# compiler, we don't add the CLR directory if -nostdlib has been specified)
...

So I nagivated to the directory where mscorlib and my target dll were located, called ikvmstub.exe from there, and it worked fine.

Upvotes: 1

Related Questions