Question

I have some addins from the System.AddIn. But when running the AddInStore.Rebuild,

string[] warnings = AddInStore.Rebuild(addInRoot);

then I get a warning string back:

The file is not a valid binary: D:\AK\AS\ConverterModule\output\AddIns\CompositeFileZip\7z.dll File Name: D:\AK\AS\ConverterModule\output\AddIns\Composi...

The 7z.dll is not the addin assembly, but the 7z file that the CompositeFileZip addin uses. I can't quite figure out what exactly the rebuild function is doing. Is it trying to add the 7z.dll as an addin?

Was it helpful?

Solution

I'm not familiar with System.AddIn or the 7z component, but a very common cause of BadImageFormatException is attempting to load an assembly that is marked as 64-bit (or dependent on a native 64-bit .dll) on a 32-bit system, or vice versa.

Check whether your 7z.dll and its dependencies are built for the same architecture as the system where you see the BadImageFormatException. You can do this from a Visual Studio command prompt by dumping the headers for 7z.dll and looking for the machine architecture:

    C:\Program Files\7-Zip>dumpbin /headers 7z.dll | findstr /i machine
            8664 machine (x64)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top