c# - ILMerge 找到的程序集 'X' list 定义与程序集引用不匹配

标签 c# .net visual-studio-2010 .net-assembly ilmerge

我一直在寻找问题的解决方案,但我找到的所有答案似乎都不符合我的问题。我正在使用 @Contango on this question 找到的 ILMerge 构建脚本。它构建完成,我可以很好地使用创建的 .exe。

当我尝试调试它时,问题就出现了。当我调试而不是仅仅构建项目时,我收到此错误:

Error while trying to run project: Could not load file or assembly 'SpecSheet_Verifier' or on of its dependencies. The located assembly's manifest does not match the assembly reference. (Exception from HRESULT: 0x80131040)

“SpecSheet_Verifier”是我的程序集的名称,而不是像我发现的大多数问题所询问的那样的 .dll。

所以,在我疯狂地尝试让它工作之前,我想检查一下是否可以调试我通过 ILMerge 构建的可执行文件。如果是的话,我该怎么做呢?

我正在使用的构建脚本:(感谢 Contango)

"$(SolutionDir)ILMerge\ILMerge.exe" /out:"$(TargetDir)$(TargetName).all.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll" /target:exe /targetplatform:v4,C:\Windows\Microsoft.NET\Framework64\v4.0 /wildcards
del *.dll
ren "$(TargetDir)$(TargetName).all.pdb" "$(TargetName).all.pdb.temp"
del *.pdb
ren "$(TargetDir)$(TargetName).all.pdb.temp" "$(TargetName).all.pdb"
del "$(TargetDir)$(TargetName).exe"
ren "$(TargetDir)$(TargetName).all.pdb" "$(TargetName).pdb"
ren "$(TargetDir)$(TargetName).all.exe" "$(TargetName).exe"
exit 0

最佳答案

我遇到了同样的错误,并且能够通过进入项目设置并确保“启用 Visual Studio 托管进程”未选中来调试 ILMERGE 的 exe。

关于c# - ILMerge 找到的程序集 'X' list 定义与程序集引用不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22513415/

相关文章:

visual-studio-2010 - Visual Studio 2010 无法识别 .cshtml 文件

c# - 如何在 C#/VS 社区中将程序导出到设计器之外

c# - 根据DependencyProperty更改ListView的显示列

c# - 您可以从 .net 运行 SSIS 任务吗?

.net - .NET应用程序是否不受经典指针错误的影响?

c++ - 无法从一种迭代器类型转换为另一种,但两者完全相同

c# - 将数字与整数分开(无字符串函数)

c# - 在 C# 中创建 "trusted"xml 文件

c# - 如何在 C# 中将 List<string> 转换为 ReadOnlyCollection<string>

c# - 使用多个版本的 Visual Studio