【问题标题】:IKVM.NET: Unable to find mscorlib.dll?IKVM.NET:找不到 mscorlib.dll?
【发布时间】:2015-09-09 20:41:42
【问题描述】:

我正在尝试使用 ikvmstub.exe 将特定的 .NET dll (System.DirectoryServices) 转换为 Java 存根。我收到以下错误:

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

我相信 DLL 依赖于我拥有的 v4.0.30319。所以我运行了这个命令,得到了以下输出:

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

我给 mscorlib 的路径绝对是正确的。作为记录,我在 Windows 7 中使用 Git Bash。我该如何解决这个错误?

【问题讨论】:

  • 编写 DirectoryServices 的 java 存根似乎...奇怪。您可能想要编写一个 dll 来公开您需要的内容,并让该用户将 dll 调用改为 DirectoryServices。 (或者更好,find a Active Directory management java library
  • 是的,这很奇怪。我正在尝试允许用户在不输入密码的情况下对 AD 进行身份验证和查询。这在 C# 中是可能的,但在我熟悉的任何 Java 库中都没有。我认为通过将 DirectoryServices 库暴露给 Java,我可以利用 C# 对现有 AD 绑定的访问。

标签: .net ikvm


【解决方案1】:

仍然不确定为什么会发生这种情况,但我通过阅读 IKVM 源解决了它。

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)
...

所以我导航到 mscorlib 和我的目标 dll 所在的目录,从那里调用 ikvmstub.exe,它工作正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多