Search code examples
c#c++-cliasp.net-core-webapi

BadImageFormat in Web .Net Core 3.1 project with CLR .Net Core Library(C++/CLI)


I have get two projects: Web .Net Core C#(3.1) and CLR .Net Core(3.1 C++/CLI). I build&compile x64 architecture in two projects. But I Can't load my Lib => BadImageFormat for this Lib and An attempt was made to load a program with an incorrect format. I add assembly link for my C++/CLI dll. Maybe I must add Ijwhost.dll from C++/CLI directory to my Web C# directory. How I can do it?


Solution

  • I solved it. Need add ljwhost.dll in host C# directory. It's work!!! For x32 architecture you must used x32 .Net Core package. Don't use AnyCPU.

    For example:

    From this ====> To this