0

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?

2
  • Writing a java stub of DirectoryServices seems... Odd. You may want to write a dll that just exposes what you need and have that user made dll call into DirectoryServices instead. (Or even better, find a Active Directory management java library) Commented Sep 9, 2015 at 20:50
  • Yes, it's odd. I'm trying to allow users to authenticate to and query AD without entering their passwords. This is possible in C# but not in any Java library I'm familiar with. I thought that by exposing the DirectoryServices library to Java I'd be able to take advantage of C#'s access to the existing AD bind. Commented Sep 10, 2015 at 13:03

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.