简体   繁体   English

无法加载文件或程序集或其依赖项之一。 找到的程序集的清单定义与程序集引用不匹配

[英]Could not load file or assembly or one of its dependencies. The located assembly's manifest definition does not match the assembly reference

I know there are several similar topics on SO about this problem (believe me, I spent the last two days reading all of those), but none of them helped in my strange situation. 我知道关于这个问题有几个类似的话题(相信我,我花了最后两天阅读了所有这些话题),但是在我遇到奇怪的情况时,它们都没有帮助。
So I come here, maybe somebody can enlighten me what could be the problem. 所以我来这里,也许有人可以启发我可能是什么问题。

We have a source of a C# (WPF) control, TreeListView. 我们有一个C#(WPF)控件的源代码TreeListView。
It's compiled with VS2015 dev command prompt using csc.exe (part of bigger project, IDE is not used for compilation) with the following parameters: 使用csc.exe(属于较大项目的一部分,IDE不用于编译)在VS2015 dev命令提示符下进行编译,并带有以下参数:

/reference:"System.Xaml.dll" 
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\PresentationCore.dll" 
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\WindowsBase.dll" 
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\WindowsFormsIntegration.dll" 
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\PresentationFramework.dll" 
/nowarn:1701,1702 /errorreport:prompt /warn:4 /platform:x86 /define:DEBUG;TRACE /debug+ /debug:full /optimize- /target:library  /out:..\debug\TreeListView.dll  

...here all the .cs source files are listed...

/resource:"..\TreeListView\obj\debug\TreeListView.g.resources" 

All of our C#/WPF DLL is compiled with the same options in the command line. 我们所有的C#/ WPF DLL都在命令行中使用相同的选项进行编译。

It compiles fine, I have the TreeListView.dll. 它编译良好,我有TreeListView.dll。 It is not strong named. 它不是强名称。
It is copied next to the mainApp.exe, and when I run the main app, and trying to use a window with this TreeListView, I got exception 它被复制到mainApp.exe的旁边,当我运行主应用程序并尝试将窗口与此TreeListView一起使用时,出现异常

*** Exception ***: System.IO.FileLoadException
Message: Could not load file or assembly 'TreeListView, PublicKeyToken=ffedd4b1334b06f5' or one of its dependencies. 
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source: mscorlib

The main_app compiled also with csc.exe, referencing exactly the output of the above compiled TreeListView.dll main_app也使用csc.exe编译, 完全引用了上面编译的TreeListView.dll的输出

Btw, don't know why it displays public key, when it's not strong named 顺便说一句,当它不是强名称时,不知道为什么显示公钥

sn -T debug\TreeListView.dll

Microsoft (R) .NET Framework Strong Name Utility  Version 4.0.30319.0
Copyright (c) Microsoft Corporation.  All rights reserved.

debug\TreeListView.dll does not represent a strongly named assembly

Other observation 其他观察

In VS2015 IDE, I created a new WPF app, and referenced the above compiled TreeListView.dll - and used the control in the XAML: it immediately shows in the GUI XAML Designer that Could not load file or assembly 'TreeListView, PublicKeyToken=ffedd4b1334b06f5' or one of its dependencies. The system cannot find the file specified. 在VS2015 IDE中,我创建了一个新的WPF应用,并引用了上面编译的TreeListView.dll-并在XAML中使用了该控件:它立即在GUI XAML设计器中显示Could not load file or assembly 'TreeListView, PublicKeyToken=ffedd4b1334b06f5' or one of its dependencies. The system cannot find the file specified. Could not load file or assembly 'TreeListView, PublicKeyToken=ffedd4b1334b06f5' or one of its dependencies. The system cannot find the file specified.
(note, here the error is The system cannot find the file specified. ) (请注意,这里的错误是The system cannot find the file specified.

在此处输入图片说明

I thougth IDE will give more information, but nothing new here. 我认为IDE会提供更多信息,但是这里没有新内容。

Other info: This whole build/run process worked fine with VS2008 (.NET3.5), now after moving to VS2015 (.NET4), updaexperiencing this, and only with this TreeControl.dll 其他信息:整个构建/运行过程与VS2008(.NET3.5)正常工作,现在移至VS2015(.NET4)之后,仅通过此TreeControl.dll进行了更新。

I checked all references of that dll, used framework, with ILSpy, ildasm, ProcessMonitor for file not found, etc but could not find anything useful. 我检查了该dll,使用的框架的所有引用,以及未找到文件的ILSpy,ildasm,ProcessMonitor等,但找不到任何有用的东西。

ildasm > manifest of TreeControl.dll - this also looks ok to me ildasm> TreeControl.dll的清单-对我来说这也可以

// Metadata version: v4.0.30319
.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 4:0:0:0
}
.assembly extern PresentationFramework
{
  .publickeytoken = (31 BF 38 56 AD 36 4E 35 )                         // 1.8V.6N5
  .ver 4:0:0:0
}
.assembly extern System.Xaml
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 4:0:0:0
}
.assembly extern WindowsBase
{
  .publickeytoken = (31 BF 38 56 AD 36 4E 35 )                         // 1.8V.6N5
  .ver 4:0:0:0
}
.assembly extern PresentationCore
{
  .publickeytoken = (31 BF 38 56 AD 36 4E 35 )                         // 1.8V.6N5
  .ver 4:0:0:0
}
.assembly extern System
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 4:0:0:0
}
.assembly extern System.Core
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 4:0:0:0
}

Any idea what to check would be really appreciated. 任何想法检查什么将不胜感激。

Try using Fuslogvw for failed binding at the run-time. 尝试在运行时使用Fuslogvw进行绑定失败。 At the time when you are running the application set settings to 'Log binding failures to disk'. 在运行应用程序时,将设置设置为“将绑定失败记录到磁盘”。

Any failed bindings will be logged on the window. 任何失败的绑定都将记录在窗口中。 You can double click on the logs to get full details about which dll is trying to load TreeListView assembly and what all locations it is trying to look for that dll. 您可以双击日志以获取有关哪个dll试图加载TreeListView程序集以及它试图查找该dll的所有位置的完整详细信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集XXX或其依赖项之一。 找到的程序集的清单定义与程序集引用不匹配 - Could not load file or assembly XXX or one of its dependencies. The located assembly's manifest definition does not match the assembly reference 无法加载文件或程序集“WebGrease”的依赖项之一。 定位的程序集的清单定义与程序集引用不匹配 - Could not load file or assembly 'WebGrease' one of its dependencies. The located assembly's manifest definition does not match the assembly reference 无法加载文件或程序集“System.Web.Mvc”或其依赖项之一。 定位的程序集的清单定义与程序集不匹配 - Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. The located assembly's manifest definition does not match the assembly 无法加载文件或程序集“ Newtonsoft.Json”或其依赖项之一。 清单定义与程序集引用不匹配。 - Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies. manifest definition does not match the assembly reference. 错误 4:无法加载文件或程序集 'MySql.Data.EntityFramework 或其依赖项之一。 定位的程序集的定义不匹配 - Error 4: Could not load file or assembly 'MySql.Data.EntityFramework or one of its dependencies. The located assembly's definition does not match Windows Universal App:无法加载文件或程序集-找到的程序集的清单定义与程序集引用不匹配 - Windows Universal App: Could not load file or assembly - The located assembly's manifest definition does not match the assembly reference 无法加载文件或程序集。 定位的程序集的清单定义与程序集引用不匹配 - Could not load file or assembly. The located assembly's manifest definition does not match the assembly reference 无法加载文件或程序集:找到的程序集的清单定义与程序集引用不匹配 - Could not load file or assembly: The located assembly's manifest definition does not match the assembly reference 无法加载文件或程序集 'MySql.Data, Version=8.0.29.0.. 找到的程序集的清单定义与程序集引用不匹配 - Could not load file or assembly 'MySql.Data, Version=8.0.29.0.. The located assembly's manifest definition does not match the assembly reference 无法加载文件或程序集。 找到的程序集的清单定义与程序集引用不匹配。 版本冲突 - Could not load file or assembly. The located assembly's manifest definition does not match the assembly reference. Version conflict
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM