获取BadImageFormatException

Kas*_*sen 0 c# system.addin

我有一些来自System.AddIn的插件.但是在运行AddInStore.Rebuild时

string[] warnings = AddInStore.Rebuild(addInRoot);
Run Code Online (Sandbox Code Playgroud)

然后我收到一个警告字符串:

该文件不是有效的二进制文件:D:\ AK\AS\ConverterModule\output\AddIns\CompositeFileZip\7z.dll文件名:D:\ AK\AS\ConverterModule\output\AddIns\Composi ...

7z.dll不是插件程序集,而是CompositeFileZip插件使用的7z文件.我无法弄清楚重建功能到底在做什么.它是否尝试将7z.dll添加为插件?

And*_*own 5

我不熟悉System.AddIn或7z组件,但是一个非常常见的原因BadImageFormatException是尝试在32位上加载标记为64位(或依赖于本机64位.dll)的程序集系统,反之亦然.

检查您7z.dll及其依赖项是否构建为与您看到的系统相同的体系结构BadImageFormatException.您可以通过转储标头7z.dll并查找计算机体系结构从Visual Studio命令提示符执行此操作:

    C:\Program Files\7-Zip>dumpbin /headers 7z.dll | findstr /i machine
            8664 machine (x64)