错误:无法完成程序集的设置(hr = 0x8013101b)。探测终止

时间:2013-11-27 05:57:42

标签: c# .net dll

我看到这个奇怪的问题。我想告知这个错误有很多帖子,但没有一个解决了我所面临的问题。以下是我的设置。

  1. 我有一个exe文件,在这个文件的csproj中,目标框架版本设置为v3.5
  2. 此exe文件加载了我的许多自定义dll。
  3. 在所有这些自定义dll中,只有1个dll的目标框架版本为v4.5,其余都是v3.5
  4. 另外,在我的exe配置文件中,我支持所有3个版本的运行时条目(请参阅下面的代码部分了解条目)
  5. 这意味着即使使用v3.5构建的exe,它应该支持v4.5加载dll吗? 但是,一旦我尝试加载dll(使用v4.5),我就会出现上述错误。我尝试启用程序集日志记录 - 但我看到的只是

    //Config file entry start
    <startup> 
    <supportedRuntime version="v2.0.50727"/> 
    <supportedRuntime version="v4.0"/>     
    <supportedRuntime version="v4.5"/> 
    </startup>
    //Config file entry end
    
    //Error start
    Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
    Running under executable  d:\My.exe
    --- A detailed error log follows.
    
    === Pre-bind state information ===
    LOG: User = 
    LOG: Where-ref bind. Location = d:\MyCustom.dll
    LOG: Appbase = file:///D:/
    LOG: Initial PrivatePath = NULL
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in LoadFrom load context.
    WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
    LOG: Using application configuration file: d:\My.exe.Config
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
    LOG: Attempting download of new URL file:///D:/MyCustom.dll.
    ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated.
    

    我的控制面板说,我有.NET framework 4.5,但我看不到'完整'条目,我只看到'客户'How to: Determine Which .NET Framework Versions Are Installed

    我也尝试过安装.NET 4.5,但它只是 - 它试图修复。 我的操作系统版本是Windows 7专业版SP1。

    任何线索。请帮忙。感谢。

1 个答案:

答案 0 :(得分:1)

查看supportedRuntime元素的documentation,订单很重要。

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll

这告诉您正在运行.NET 2.0运行时。在2.0运行时运行时,您永远无法加载4.5 dll。