Windows error 0x8007000B, -2147024885

Detailed Error Information

BAD_FORMAT[1]

MessageAn attempt was made to load a program with an incorrect format.
Declared inwinerror.h

COR_E_BADIMAGEFORMAT[2]

Message"The format of a DLL or executable being loaded is invalid."
Comment The format of DLL or executable being loaded is invalid.

HRESULT analysis[3]

FlagsSeverityFailure
Reserved (R)false
OriginMicrosoft
NTSTATUSfalse
Reserved (X)false
FacilityCode7 (0x007)
NameFACILITY_WIN32[3][1]
DescriptionThis region is reserved to map undecorated error codes into HRESULTs.[3][1]
Error Code11 (0x000b)

This is a Win32 error which has been mapped into an HRESULT. More information may be available in error 0x0000000b.

Questions

424votes
15answers

"An attempt was made to load a program with an incorrect format" even when the platforms are the same

I'm calling functions from a 32-bit unmanaged DLL on a 64-bit system. What I get is: > BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) At first, I had my projects set to the Any CPU platform, so I changed them [...] read more
.net
64bit
pinvoke
32-bit
badimageformatexception
90votes
18answers

Troubleshooting BadImageFormatException

I have a Windows service written in C# using Visual Studio 2010 and targeting the full .NET Framework 4. When I run from a Debug build the service runs as expected. However, when I run it from a Release build I get a System.BadImageFormatException (details below). I've been searching the [...] read more
c#
.net
exception
58votes
10answers

Infamous assembly binding error

I really need help on this because I lost my hopes to correct the problem. I am using Office Communications Server 64bit libraries. There are 3 dlls I use in the project, Microsoft.Rtc.Collaboration.dll, Microsoft.Rtc.Internal.Media.dll and SIPEPS.dll. I am not sure about Microsoft.Rtc.Collaboration but Internal.Media and SIPEPS are both x64. On [...] read more
visual-studio-2010
64bit
32votes
11answers

BadImageFormatException when loading 32 bit DLL, target is x86

I have a DLL (FreeType) which is certainly 32-bit (header: IMAGE_FILE_MACHINE_I386). I want to use it from C# code, using DllImport. Target of my application is x86, IntPtr.Size is 4, process is 32-bit. But I get BadImageFormatException (Exception from HRESULT: 0x8007000B). What can be wrong? Of course I use 64-bit [...] read more
c#
dll
dllimport
32bit-64bit
badimageformatexception
28votes
18answers

BadImageFormatException. This will occur when running in 64 bit mode with the 32 bit Oracle client components installed

I am getting this error while on of my .Net application are trying to make a connection to oracle database. The error says that This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.. But I have made sure many times that [...] read more
.net
oracle
oracle11g
23votes
10answers

BadImageFormatException when AnyCPU test assembly implements interface from x64 production assembly

I seem to have hit on a scenario where when I run mstest on an AnyCPU assembly which references an x64 assembly, I get a BadImageFormatException. The issue occurs when an interface in x64Production.dll is implemented (even if unused) by the AnyCPUTestingx64Production.dll test assembly: Unable to load the test container [...] read more
c#
visual-studio-2010
mstest
64bit
18votes
1answer

Why does calling a generic local function with a dynamic parameter produce a BadImageFormatException?

Playing around with C# 7's Local Functions, I ended up with some interesting behavior. Consider the following program: public void Main() { Console.WriteLine("Entered Main"); DoSomething(""); } private void DoSomething(object obj) { Console.WriteLine("Entered DoSomething"); Generic((dynamic)obj); GenericLocal(obj); GenericLocal((dynamic)obj); // This breaks the program void GenericLocal<T>(T val) => Console.WriteLine("GenericLocal"); } private void Generic<T>(T [...] read more
c#
generics
dynamic
c#-7.0
16votes
10answers

.net Framework Error (HRESULT 0x8007000B)

I have a C# application which was written on a 32bit windows XP machine with Visual Studio 2005. The application runs fine on Windows XP machines, however when I try to run it on a 64bit Windows 7 professional machine, I get the following dialog-box on start up: enter image [...] read more
c#
.net
x86
64bit
12votes
3answers

ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated

I'm getting the following error using visual Studio Express 2013 for Web. It previously work on 32 bit. My laptop is 64 bit Windows. ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated. I've rebuild the solution with 64 bit cpu selected and no joy. read more
visual-studio
64bit
visual-studio-exp-2013
10votes
3answers

Could not load file or assembly 'Magick.NET-x64' issue on mvc application

I am using the Magick.net library in an mvc3 web application and these are steps i did My project is targeting AnyCPU and my machine is 64bit Add reference of Magick.NET-x64.dll to the project. Installed Visual C++ Redistributable for Visual Studio 2012 Update 4 from here http://www.microsoft.com/en-us/download/details.aspx?id=30679Installed Ghostscript 9.14 for [...] read more
c#
asp.net-mvc-3
magick.net
assembly-loading
8votes
3answers

Could not load file or assembly 'System.Data.SQLite' or one of its dependencies. An attempt was made to load a program with an incorrect format

I am trying to use 64-bit Sqlite on my Aspx project. When I run the project, I got the following error: > Could not load file or assembly ‘System.Data.Sqlite’ or one of its dependencies. An attempt was made to load a program with an incorrect format. I even set the [...] read more
c#
asp.net
sqlite3
8votes
2answers

Signtool "Error: SignerSign() failed." (-2147024885/0x8007000b)

EDIT Event log error was this: error 0x8007000B: The app manifest publisher name (CN=...) must match the subject name of the signing certificate (CN={19BE29DF-4812-4F2E-8FC1-A138B146946A}). The command below now seems to work. So either user error on my part that I cannot identify or something hinky with the state of machine [...] read more
windows-store-apps
signtool
appx
desktop-bridge
desktop-app-converter
6votes
2answers

ASP.NET libwebp.dll how to save WebP image to disk

I've built libwebp.dll for WebP, using these instructions (I downloaded this source code) I've added the libwebp.dll file to the bin folder of my project. I then added this code (found here): Private Declare Function WebPEncodeBGRA Lib "libwebp.dll" (ByVal rgba As IntPtr, ByVal width As Integer, ByVal height As Integer, [...] read more
asp.net
windows
vb.net
image
webp
6votes
1answer

DllImport - An attempt was made to load a program with an incorrect format

I want my C# application to conditionally run a native method. Deciding at run time whether to run either the x86 or the x64 version of the dll. This question explains how to choose 32 bit or 64 bit at compile time, but that does not help. I want to [...] read more
c#
dllimport
6votes
4answers

how to configure EmguCV and Visual Studio Express 2010 in Win8.1x64

I am developing an application via EmguCV and Visual Studio Express 2010 in Win8.1x64. when I create a new project (C# windows application), it automatically choose x86 as target platform and there is no other choice. When I try to read an image with below code I get the error. [...] read more
c#
visual-studio-2010
emgucv
4votes
9answers

The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception?

I'm working on a project and have run into an issue. When I run my code I get the error message: The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception The title of the message is "TypeInitializerException was unhandled". I receive this error at this line of code: this.crystalReportViewer = new [...] read more
c#
visual-studio-2010
crystal-reports-xi
unhandled-exception
4votes
2answers

Could not load file or assembly 'Microsoft.SqlServer.BatchParserClien.dll File Name

I have this crazy issue where a SMO operation is failing, and the only difference is this odd file in my bin folder: > Could not load file or assembly 'Microsoft.SqlServer.BatchParserClien.dll NOTE: That is not a typo, that is the actual name of the file in the file system. I [...] read more
c#
sql-server
visual-studio-2017
smo
4votes
2answers

Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format

I'm trying to build a sample web application from a blank web form template in VS2012, and add the PDFNet dll to it. If I run the project in .NET 3.5 no problem. If I run it in .NET >= 4 I get this error: Could not load file or [...] read more
.net
load
.net-assembly
4votes
1answer

Visual Studio 2017 update issue: Unable to load DLL ‘sqlite3’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

While upgrading vs2015 .net standard to vs2017, I got the following error in test project. > Unable to load DLL ‘sqlite3’: The specified module could not be found. (Exception from HRESULT: 0x8007007E) It works well with vs2015, sqlite provider 1.0.101.0 New Environment: Visual Studio 2017, TargetFramework="net461" using .netcore1.1 packages, sqlite [...] read more
sqlite3
visual-studio-2017
3votes
1answer

Solution for running a 32 bit DLL in a 64 bit process or vise versa

I am running windows vista business 64 bit. I have a web service that was written in .NET using C#. I also have a client-side script on a web page that communicates with the web service. This is a aspx page titled "Default.aspx". I setup IIS and moved my web [...] read more
windows
iis
windows-vista
.net
3votes
2answers

Unable to load dll file - exception 0x8007007E

I'm working with National Instruments Measurement Studio in C#, and I've come across a bit of a problem in deploying my application to a particular computer (running Windows 7). I've tried asking on the National Instruments forums, but haven't got any solutions yet - could anyone here give me some [...] read more
c#
.net
dll
3votes
3answers

WCF 64 bit not working

I'm trying to develop a simple WCF service running in a 64 bit environment. I fire up VS2010 under Windows 7 New Solution -> WCF project -> Run -> It works fine. As soon as I change the properties of the project in order to make it compile in 64 [...] read more
visual-studio
wcf
sharepoint
64bit
3votes
1answer

Emgu Could not found cvextern in IIS server

I'm having some issues running the Emgu on my server. It runs fine locally, but when I try to use it on the server with IIS, it doesnt work. Here is the error: System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'cvextern': The [...] read more
c#
asp.net-mvc
iis
emgucv
3votes
0answers

Pythonnet in Visual Studio 2017

I am trying to run Visbrain using Pythonnet in Microsoft Visual Studio 2017 Community in a window form, but i faced some problem below. Environment 1) Pythonnet version : v2.3.0 i downloaded this from "Manage Nuget-Package" in Visual Studio 2017 Community. 2) Python version : Python 3.6.5 (Amaconda 3) Already [...] read more
c#
python
.net
visual-studio
python.net
3votes
2answers

BadImageFormatException when deploying on windows server 2012 r2

I am deploying my Asp.net application on Windows Server 2012 R2(x64). I get a runtime BadImageFormatException while using 64-bit dll. When I run it with IIS Express or application published on local machine IIS everything works well (Application pools -> solution name -> Enable 32-bit applications set to False, All [...] read more
c#
asp.net
iis
dll
windows-server-2012-r2
2votes
0answers

How do I fix a corrupted WIM file?

TLDR I have a corrupt WIM archive that I'm trying to extract. I have tried using DISM, but it won't let me mount it because it doesn't recognize it as a WIM file. I have also tried editing it with a hex editor, but I don't know what I can [...] read more
windows-10
7-zip
dism
wim
2votes
1answer

Lightweight Oracle support in .NET core

I'm trying to connect to an Oracle database from a containerable dotnet core application, and haven't been able to find a solution that allows me to do this that fits all of these criteria: * Runs in .NET Core 2.0 * Doesn't require extra installation on the machine running it [...] read more
oracle
.net-core
2votes
0answers

UWP APPXBundle issue to bundle languages

Into my MyProject.AppPackage.wapproj, i have changed AppxBundle from Always to Never, to have all resources in one bundle (mostly based to have all languages available at runtime). Changed line it's the third. <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <DefaultLanguage>fr-CH</DefaultLanguage> <AppxBundle>Never</AppxBundle> </PropertyGroup> I have changed my TFS Build Solution task removing /p:AppxBundle=Always now it looks [...] read more
c#
tfs
uwp
msbuild
makeappx
2votes
1answer

Install IIS with Inno Setup

I'm trying install IIS with Inno Setup, but I'm getting various errors. I tried command on DOS and works: > start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-ManagementService;IIS-CGI;IIS-RequestFiltering;IIS-ASPNET;IIS-HttpLogging;IIS-NetFxExtensibility;IIS-HttpErrors;IIS-DefaultDocument;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-StaticContent;IIS-ManagementConsole;IIS-DirectoryBrowsing;IIS-WindowsAuthentication;IIS-WebServer; I tried use this in Inno Setup: > Filename: pkgmgr; Parameters: "/iu:IIS-WebServerRole; IIS-WebServer: ; IIS-CommonHttpFeatures: ; IIS-ManagementService: ; IIS-CGI: ; IIS-RequestFiltering: ; IIS-ASPNET: ; IIS-HttpLogging: ; [...] read more
windows
iis
inno-setup
2votes
1answer

An attempt was made to load a program with an incorrect format (.dll)

My program compiles nicely, but when I run the program I get this error: "System.BadImageFormatException thrown calling IO_Init(). Message=An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)" As far as I understand, this error is because my program tries to use a dll [...] read more
c#
visual-studio
dll
2votes
4answers

TeamCity: GhostscriptSharp: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

PDF converting fails while running test on CI. I'm using GhostscriptsSharp library for converting. I'm not facing this issue while running my test locally, PDF-file is converted to images correctly. I've been searching the internet for a solution but so far every thing I've found hasn't helped me find a [...] read more
c#
continuous-integration
teamcity
badimageformatexception
ghostscriptsharp
2votes
5answers

"The underlying provider failed on Open"

I keep getting this error when trying to open a connection using entity framework. I can update the model from the database with no problems at all, but when I run the code in debug it gives this error. (Running on a Windows 2008 VM) The code fragment where the [...] read more
c#
wcf
entity-framework
2votes
1answer

BadImageFormatException Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format

I am getting following runtime error, with my console application(VS2012) which refers to "dcasdk.dll". .Net Framework of the console app is 4.5, platform target is "Any CPU". Could not load file or assembly 'dcasdk, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program [...] read more
c#
.net
.net-assembly
badimageformatexception
target-platform
1vote
1answer

How do you fix error 0x8007000b in Windows Live Photo Gallery?

When you start Windows Photo Gallery (formerly Windows Live Photo Gallery, now part of Microsoft Essentials 2012), you may receive the following errors, and the application will close: Windows Live Photo Gallery encountered an error and can't start. Error Code: 0x80070043 read more
windows
windows-photo-gallery
1vote
2answers

Calling a FORTRAN subroutine from C# at the console

I want to call a FORTRAN subroutine from C# using commands entered at the console. I have been trying for two days now, reading many web pages, and following much advice, but with no success. Here is a typical example of my many failed attempts. Using a text editor (Notepad) [...] read more
c#
fortran
interop
1vote
0answers

Loading C# assembly from MemoryStream: Bad IL format. How to correctly load fully in-memory assembly?

Using .NET Core 2.1 and Microsoft.CodeAnalysis.CSharp.Scripting 2.10.0 to dynamically compile to assembly and keep it in-memory. Then trying to load this assembly via AssemblyLoadContext getting > Bad IL format How to correctly load fully in-memory assembly? What is the reason of this exception? I am missing to specify some metadata [...] read more
c#
.net-core
dllimport
asp.net-core-2.1
1vote
1answer

"An attempt was made to load a program with an incorrect format" thrown in debug but not from unit test. Why?

Hi I have looked at other answers and I don't see anything that would answer this, I have code that executes correctly when initiated by a unit test but throws > An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) When the same [...] read more
c#
unit-testing
debugging
exception
1vote
2answers

flashdevelop built error: Can't initialize jni4net. (32bit vs 64bit JVM vs CLR ?)

I'd reinstalled Windows on my PC, after that flashdevelop started to throw errors while building. Application starts for a few seconds, but then closes. output: Error details: net.sf.jni4net.jni.JNIException: Can't initialize jni4net. (32bit vs 64bit JVM vs CLR ?) CLR architecture: 64bit JAVA_HOME: C:\Program Files (x86)\Java\jre6 ---> System.BadImageFormatException: . (Exception from [...] read more
java
flash
clr
flashdevelop
1vote
1answer

OpenCVSharp: Unable to load DLL 'OpenCvSharpExtern'

I have installed the latest OpenCVSharp 2 (2.4.10.201...) with the NuGet manager in my project. Everything concerning OpenCVSharp.CvMat is working OK (loading, manipulation etc) so I am sure the installation is correct. However I cannot use OpenCVSharp.CPlusPlus at all! The problem is that it doesn't load OpenCvSharpExtern.dll. Error shown from [...] read more
c#
.net
opencv
opencvsharp
1vote
1answer

AutoFixture/AutoMoq: Unable to Create Instance (`BadImageFormatException`)

Below is a minimal example of the problem I am currently encountering: using System.Net.WebSockets; using AutoFixture; using AutoFixture.AutoMoq; using FluentAssertions; using Xunit; ... [Fact] public void Test1() { var fixture = new Fixture().Customize(new AutoMoqCustomization() { ConfigureMembers = true }); var sut = fixture.Create<WebSocket>(); sut.Should().NotBeNull(); } [Fact] public void Test2() { [...] read more
moq
autofixture
automoq
1vote
1answer

How to specify that T4 template should be transformed using x64 platform?

I am trying to create a C++ wrapper for a .NET library called SEI (link, file USDDeviceExplorer_x64_1.zip). To do that, I am writing a T4 template which references USDSEI.dll assembly like this: <#@ assembly name="$(SolutionDir)..\USDDeviceExplorer_x64_1\USDigital.dll" #> <#@ assembly name="$(SolutionDir)..\USDDeviceExplorer_x64_1\AGauge.dll" #> <#@ assembly name="$(SolutionDir)..\USDDeviceExplorer_x64_1\USDSEI.dll" #> But template is not getting transformed [...] read more
c#
.net-4.0
t4
1vote
1answer

Go to library to C# | BadImageFormatException

I would like to create a library out of go-code and use it inside a C# winforms project. For the error scroll to the bottom. Setup * GO 1.10.2 * tdm-gcc-5.1.0-3 * Windows 10 / x64 * Go-project called exprt What I've tried I've created a minimal go-tool that creates [...] read more
c#
go
compilation
shared-libraries
shared
1vote
0answers

SignTool error: SignerSign() failed." (-2147024885/0x8007000b) when signing msi file

We recently purchased an EV Code Signing Certificate. I followed instructions and I can successfully sign our built applications (exe files), our libraries (dll). However, I can't sign our setup packages (MSI files), I always get this error: > SignTool Error: An unexpected internal error has occurred. Error information: "Error: [...] read more
signing
signtool
1vote
1answer

ionic windows app signing issue

i need to deploy ionic windows app to enterprise store. so, after building windows when trying to sign with signtool getting error "0x8007000b" which means publisher name mismatch. so, i have edited my appx10manifest.xml and rebuilt using ionic build windows same result. what is understood is that when i am [...] read more
cordova
ionic2
windows-mobile
signtool
1vote
0answers

Windows Azure: Could not load file or assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client.Cache'

I'm trying to debug a ASP MVC application in the Windows Azure Compute emulator and I'm getting the following error before the application starts. My configuration is the following: * Windows 8 x64 * Windows Azure Compute emulator (debugging local) * IIS express (this is important since the error is [...] read more
.net
asp.net-mvc
azure
1vote
0answers

WCF Service with a thid-party DLL: "BadImageFormatException" or "PInvoke unbalanced stack" exception

I am trying to use DinkToPDF in a WCF service to generate a PDF file from HTML. This library is a wrapper for the wkhtmltopdf library. This requires having the 32 bit or 64 bit .dll for wkhtmltopdf in the solution root folder. When the DinkToPDF "BasicConverter.Convert()" method is called, [...] read more
wcf
iis
dll
wkhtmltopdf
1vote
1answer

Embedd cwbdc.dll from IBM i Client Access manually to console application

Is it possible, wo reference the cwbdc.dll which comes with the i Client Access from IBM manually in a console application with C# .Net? I would like to connect to a AS400 database without installing i Client Access but only by using IBM.Data.DB2.iSeries and the provider wich comes with the [...] read more
c#
dll
db2
1vote
2answers

c# visual studio sql lite

my friend and I are currently a program in which we are using a sql lite database. When he is compiling the project, the database loads up without any problems. But when I try to compile the project (which works fine) and load the database the following error appears: > [...] read more
c#
sql
load
1vote
2answers

System.BadImageFormatException when trying to resolve constructor of System.Collections.Generic.GenericComparer`1

I have a problem with the following code: var type1 = typeof(object); var type2 = type1.Module.GetType("System.Collections.Generic.GenericComparer`1"); var constr = type2.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); var byteArray = constr.GetMethodBody().GetILAsByteArray(); var result = type2.Module.ResolveMethod(BitConverter.ToInt32(byteArray, 2)); Everytime I execute it it gives me the following error: An exception of type [...] read more
.net
reflection
comexception
badimageformatexception
1vote
2answers

Excel 2016 VSTO Addin With Native Code DLL

Creating an Excel addin using an SDK from a 3rd party. The SDK contains a native code DLL (in both 32 and 64 bit versions). My addin code is in C# and it appears that addins only run if compiled under "AnyCPU" option. When I attempt to run the app [...] read more
c#
c++
excel
dll
vsto
1vote
2answers

Allow PDFium to support x86 and x64

I've built a WinForms app which uses PDFium to print PDF documents. I installed PDFium from NuGet, and it created two subfolders in my project - x86 and x64 - as expected, each with the relevant version of pdfium.dll inside. My application's target platform is set to Any CPU. When [...] read more
c#
winforms
pdfium
1vote
1answer

How to sign AppX from Desktop App Converter

I have been trying to sign the AppX generated by the D.A.C. in order to verify it works as expected, but it seems a self signed certificate is not enough. I also tried to sign using my Comodo SHA256 certificate, but even if I make sure to use the same [...] read more
uwp
windows-store-apps
appx
project-centennial
desktop-bridge
1vote
3answers

Target Platform and 'Could not load file or assembly' error

I have a Win Forms application that targets 64 bit platform (it is required as it uses the 64-bit Oracle.DataAccess libraries). I've added an ASP.net forms application to this solution, and I would like to add a reference to the WinForms app to the ASP.net app. My WebApp also targets [...] read more
asp.net
winforms
assemblies
target-platform
0votes
1answer

New IIS site - WebApp Error

I setup IIS. I moved my folder with all the files to the IIS directory. Now when I go to http://localhost/thefolderI get: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) Description: An unhandled exception occurred during the execution of the current web [...] read more
iis
0votes
0answers

Can't start SQL Server 2008

I just installed SQL Server 2008 R2 and I can't get it started. I opened the configuration manager, but the SQL Server, Agent and Browser options can't be started (the start option is greyed out, as well as stop, restart and others). I also tried running it as admin but [...] read more
windows-xp
sql-server-2008
0votes
0answers

BadImageFormatException - Reason behind 32-bit and 64-bit conflict not affecting ASP.NET

I created two project 1. ASP.NET Core Web Application | Core 2.2 2. ASP.NET Web Application (.NET Framework) | .Net 4.6.1 In my test controller, I used an exported function from a 32-bit unmanaged DLL, using [DllImport("Testing.DLL")] Copy that 32-bit native DLL file in both the project folders Run as [...] read more
asp.net-mvc
asp.net-core
iis-express
0votes
0answers

EMGU CV Invoke error in Image.... object....All Visual Studip project is any cpu targetting...chaging target no use

An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) In Emgu.CV.Invoke....I am getting above error. My projects are configured with "Any CPU". I installed latest version of EMGUCV in nuget.... img = new Image<Bgr, byte>(bitmapImage); read more
c#
.net
c#-4.0
dll
emgucv
0votes
1answer

Citrix wfapi/mfcom working example

I installed Wfapi SDK. All standard examples for Wfapi in VB and C work just fine but I wanted to wrap the dll to use it in C#. However the example from the official site VSSDKNET Wrapper converted into VS10 standard and compiled gives me the incorrect format HResult : [...] read more
c#
citrix
virtual-channel
0votes
0answers

Outlook add-in won't install after Visual Studio upgrade

I have a Microsoft Outlook add-in that was fully working in debug mode but the click-once installer wasn't working. So I decided to upgrade Visual Studio thinking that might help. I then discovered that the reason I couldn't install was a corruption in the Add-in project, which was stopping the [...] read more
visual-studio
outlook
add-in
0votes
0answers

How to use a 3rd party DLL in c#

I have a 3rd party DLL that I need to use in a c# application (.net 4.6.1). This is a 64 bit DLL, but I have a 32 bit version as well. The DLL is used successfully in vba (excel 64 bit) as follows: Declaration: Private Declare PtrSafe Function TheFunction [...] read more
c#
excel
vba
dll
0votes
0answers

asp core project can't starting HTTP Error 502.5 - Process Failure IIS

I can't understand why this project don't start. It's logs don't give me normal explanation. I use asp core and have project version 1.0.1. I install .NET Core 1.1 Runtime & Hosting Bundle server because this latest version. I'm not be able to update project. Logg : info: Microsoft.Extensions.DependencyInjection.DataProtectionServices[0] User [...] read more
asp.net
iis
.net-core
0votes
0answers

C# using a DLL causes an error - how can I fix that?

I got dll from a C# app resources it works fine with the app, but when I use it In my c# code I get this error: > An incorrect format. (Exception from HRESULT: 0x8007000B) I searched for the error, it's because dependency of the dll, so I used depends [...] read more
c#
dll
0votes
1answer

Issue when trying to connect to Oracle DB in C#

I am trying to connect to an Oracle DB using the following method: OracleConnection con = new OracleConnection(); con.ConnectionString = "User ID=ID;Password=PASSWORD;Data Source=SOURCE"; con.Open(); write("connected to oracle " + con.ServerVersion); But every time I run the program I get the error: > [2018-11-01 09:29:19.705] System.BadImageFormatException: Could not load file or [...] read more
c#
database
oracle
oracle11g
0votes
1answer

Trying to call third party dll from Azure Function V2 I get an exception

I strictly follow this sample: https://odetocode.com/blogs/scott/archive/2018/02/14/pdf-generation-in-azure-functions-v2.aspx I download the three files from the DinkToPdf repository Problem is when I add either 32bit OR 64bit DLLs, I get the following error: > One or more errors occurred. (An attempt was made to load a program with an incorrect format. (Exception from [...] read more
c#
.net
azure
azure-functions
wkhtmltopdf
0votes
0answers

Error to start service from Matlab in WebService

I'm building a web service that use a matlab class. I have export from matlab program my HRVAS.dll, then I have add it on my Project. To use this class I must include also MWArray.dll. So if I try to start my project, I have this error: Server error in [...] read more
matlab
rest
0votes
0answers

pvk2pfx.exe says bad file format

I have read that to create a .PFX file in Windows I have to use this commandline: pvk2pfx.exe -pvk MyKey.pvk -spc MyKey.cer -pfx MyPFX.pfx So I started cmd as Administrator and typed this commandline: "C:\Program Files (x86)\Windows Kits\8.1\bin\x64\pvk2pfx.exe " -pvk R:\key\mykey.key -spc R:\mycert.crt -pfx R:\MyPFX.pfx ERROR: Bad file format. (Error [...] read more
x509certificate
0votes
1answer

BadImageFormatException with SQLite in ASP.NET razor website

I'm trying to create a very simple webshop in Razor with SQLite. Unfortunately, when i trying to create the database (or creating the SQLiteConnection object) it throws a strange System.BadImageFormatException. > An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"} System.BadImageFormatException My code [...] read more
c#
asp.net
sqlite
razor
0votes
0answers

System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at

I am getting following error when running the application. System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op) System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op) at [...] read more
sqlite
outlook
0votes
0answers

An attempt was made to load a program with an incorrect format.(HRESULT: 0x8007000B) while whole architecture is 32 Bit

I am facing this issue while DLL Importing a 32 bit C++ DLL in Windows Service which is also 32 bit. I have even tried using LoadLibrary method and the issue remains same. The same source code and dll are working perfectly fine on 64 bit systems! Can anyone please [...] read more
c#
windows-services
32bit-64bit
dllimport
loadlibrary
0votes
2answers

BadImageFormatException, when trying to add .dll file to C# project - Intel realsense SDK

Every time i try to compile i'm getting this error: > System.BadImageFormatException: 'An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)' when i try to run session = PXCMSession.CreateInstance(); I'm running Windows 10 pro, 32 bit operating system. Added reference to file: > [...] read more
c#
sdk
intel
badimageformatexception
realsense
0votes
1answer

UWP - SQLite - An attempt was made to load a program with an incorrect format

I have taken over a UWP application that uses a SQLite database and runs perfectly locally on the same PC as WebService. I created the packages by using the store to run it on a Microsoft Surface (x64 Windows 10 Professional). The application calls a SOAP WebService in ASP.Net on [...] read more
c#
sql-server
sqlite
asp.net-web-api
uwp
0votes
1answer

Random errors when building solution

When building my solution, I randomly receive one of these errors: > C:\working_directory.nuget\NuGet.targets(91, 5): Type handle 'NuGet.ProjectModel.LockFile' and method handle with declaring type 'NuGet.ProjectModel.HashCodeCombiner' are incompatible. Get RuntimeMethodHandle and declaring RuntimeTypeHandle off the same MethodBase. C:\working_directory.nuget\NuGet.targets(91, 5): error MSB3073: The command ""C:\working_directory.nuget\NuGet.exe" install "C:\working_directory\Project_A\packages.config" -source " https://www.nuget.org/api/v2/" -NonInteractive -RequireConsent -solutionDir [...] read more
c#
.net
nuget
0votes
2answers

Could not load file or assembly 'Microsoft.AspNet.Scaffolding.12.0' or one of its dependencies

After pulling an old project down from source control and attempting to run it, I'm getting the following error: === Pre-bind state information === LOG: DisplayName = Microsoft.AspNet.Scaffolding.12.0 (Partial) WRN: Partial binding information was supplied for an assembly: WRN: Assembly Name: Microsoft.AspNet.Scaffolding.12.0 | Domain ID: 3 WRN: A partial bind [...] read more
c#
asp.net
asp.net-mvc
visual-studio
visual-studio-2015
0votes
1answer

The type initializer for 'Sybase.Data.AseClient.AseConnection' threw an exception

I created ASP.Net web application in Visual Studio 2013. This application uses Sybase.Data.AseClient.dll to connect to Sybase database. When I press F5 and debug application then it runs fine. No issues. But when I publish it using VS in C:\inetpub\wwwroot folder then I get following error when trying to browse [...] read more
asp.net
visual-studio-2013
sybase-ase
0votes
2answers

Could not load file or assembly 'log4net' or one of its dependencies, even after removing log4net

I've gone through another questions here and here but seems that I still could not solve this problem. Even when I try to remove the reference 'log4net' from my program, when I run it still gives the same error. Any ideas? OS used : Win 7-64 bit. IDE : Visual [...] read more
asp.net
log4net
0votes
0answers

Calling c++ function in .NET

I have a c++ function that I would like to call in .NET however I get an error System.BadImageFormatException: 'An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)' Here is my c++ dll code Header #pragma once #ifdef SIMPLEDEMO_EXPORTS #define SIMPLEDEMO_API __declspec(dllexport) #else [...] read more
c#
c++
.net
dll
dllimport
0votes
1answer

Could not load file or assembly 'Autofac.Integration.ServiceFabric' or one of its dependencies

I am trying to run a service fabric project in visual studio 2015. The following service fabric dependencies has been installed in the machine. Microsoft Azure Service Fabric 5.6.210.9494 Microsoft Azure Service Fabric SDK 2.6.210.9494 Microsoft azure Service Fabric tools for Visual studio 1.6.50508.2 The project is getting build successfully. [...] read more
asp.net-mvc
azure
azure-service-fabric
0votes
0answers

MSMQ not working on Windows 8 machine

I am trying to use MSMQs as below string _QueueName = "\\MyServer\MyQueue"; if ( MessageQueue.Exists(_QueueName) ) // Error here { _Queue = new MessageQueue(@"FormatName:DIRECT=OS:" + _QueueName); _Queue.Formatter = new XmlMessageFormatter(new Type[] { typeof(MyItem) }); } My application compiles and runs successfully on windows 7 64 bit machine. If I take [...] read more
c#
msmq
0votes
1answer

An attempt was made to load a program with an incorrect format - only when published in the hoster

I have a C# asp.net Project that calls a .dll file made in C++. Running locally in my computer, it works well. But, when publishing it on line in my web site hoster, there is an error: “An attempt was made to load a program with an incorrect format. (Exception [...] read more
asp.net
dll
0votes
1answer

ManagedOpenSsl in .net core throws "System.BadImageFormatException:"

I have been facing multiple challenges with getting the ManagedOpenSsl to work with .Net Core. I downloaded ManagedOpenSsl.NetCore from nuget package. My End Goal is to create a .pfx file from certificate PEM and private key. In the below code, ocert.KeyPair.PrivateKey is the certificate private key and ocert.CertificatePem is the [...] read more
c#
.net-core
openssl-net
0votes
1answer

Unhandled Exception: System.BadImageFormatException Exception from HRESULT: 0x8007000B

Published neoj using visual studio 2017 and got neoj.exe file under bin\Release\PublishOutput but while running the neoj.exe file it throws: > Unhandled Exception: System.BadImageFormatException An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) and window show as dotnet has stopped working. Anyone plz [...] read more
windows
visual-studio
neo4j
0votes
0answers

What version of PowerShell on target machine does InstallShield use?

I have an installer (suite + MSI package) for a 32-bit application that is created using InstallShield 2015. One of the custom actions that is executed (during the OnBegin event in the Suite) is a PowerShell script. In the PS script, I'm attempting to load/interact with a C++ DLL (32-bit) [...] read more
powershell
32bit-64bit
installshield
0votes
0answers

Firebird: An attempt was made to load a program with an incorrect format (Exception from HRESULT:0x8007000B)

System Type: 64-bit OS, x64-based processor Front End: MS Visual Studio 2010 Backend: Firebird database v2.5.0 64-bit Server type: Embedded type (NOTE: Standalone Server v2.5.0 is also present in my system) Firebird .NET Provider v2.5.0 NB: There are some special reasons why I'm using such old version of VS & [...] read more
c#
visual-studio-2010
dll
firebird
firebird-embedded
0votes
1answer

Why C# reflection throw this BadImageFormatException

Here is my application code. Just simple one. I'm new in C#. I tried other examples which work perfectly. But the exception "An attempt was made to load a program with an incorrect format." I have no clue why. Please let me know. Is there a way that the Core.dll [...] read more
c#
reflection
0votes
0answers

Convert a call to old DLL from vb5 to c# - System.BadImageFormatException

I have an old program writed in VB5. This program call a DLL writed in c++. I want to made conversion from VB5 to C#. This is the original code: Declaration in VB5: Option Explicit <br> Private Declare Sub GENRAS _ <br> Lib "C:\WINNT\system\genras32.dll" _ <br> (ByVal pmarca_de_input As String, [...] read more
c#
c++
dll
vb5
0votes
0answers

DLL import not working in web api project(.net core)

Hi I tried to import c library into c# console application as below. class Program { [DllImport("C:/Users/INNIGOD1/source/repos/Dll1/Debug/Dll1.dll", CallingConvention = CallingConvention.Cdecl,EntryPoint = "sum")] internal unsafe static extern int Sum(int x, int y); public static void Main(string[] args) { int a = 1; int b = 2; int c= Sum(a, b); } [...] read more
c#
c
dll
0votes
0answers

Entity Framework 6 - An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

I've published my application to my server (iis7.5 windows server 2008 R2, asp.net4). I tried to set build to x86, x64, any cpu and it doesn't worked. I tried to allow 32bit applications through IIS and still the same result. The error occurred only when I try to get some [...] read more
c#
asp.net
asp.net-mvc-3
entity-framework-6
0votes
0answers

Creating a HDF5 file

I'm trying to create a hdf5 file with Visual Basic code: Module file_operations Sub Main() Dim fileid As Long Dim h5 As Integer h5 = HDF.PInvoke.H5.open() ' <===Error at this line==<< fileid = HDF.PInvoke.H5F.create("file_name.h5", HDF.PInvoke.H5F.ACC_TRUNC) Dim group1 As Long = HDF.PInvoke.H5G.create(fileid, "/home") Dim group2 As Long = HDF.PInvoke.H5G.create(group1, "/music") HDF.PInvoke.H5F.close(fileid) [...] read more
.net
vb.net
hdf5
0votes
1answer

How to debug a 0x8007000B exception?

We have a C# application, that is compiled as a AnyCPU. This application uses an external library(which is also a .Net DLL on AnyCPU) that loads some C++ libraries in externals DLL. Thoses externals libraries are either for X86, either for X64. We have a postbuild event that copies the [...] read more
c#
.net
debugging
dllimport
0votes
0answers

Elmah mvc BadImageFormatException

I want to use elmah in mvc applicaion. I installed elmah from nuget PM> Install-Package Elmah.MVC -Version 2.1.2 I added following code to webConfig file: <appSettings> <add key="elmah.mvc.disableHandler" value="false" /> <add key="elmah.mvc.disableHandleErrorFilter" value="false" /> <add key="elmah.mvc.requiresAuthentication" value="false" /> <add key="elmah.mvc.IgnoreDefaultRoute" value="false" /> <add key="elmah.mvc.allowedRoles" value="*" /> <add key="elmah.mvc.allowedUsers" value="*" /> [...] read more
c#
model-view-controller
error-handling
elmah.mvc
0votes
1answer

System.Data.SqlServerCe. An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

I have created a web project which uses sql compact but when I run this project, It gives me below error.enter image description here [https://i.stack.imgur.com/y7MSw.png] > An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) But When I check below option to run [...] read more
c#
asp.net
dll
sql-server-ce
asp.net-4.5
0votes
1answer

C# code works but errors occur while packaging my UWP application in Visual Studio 2017

I have created a UWP application in Visual Studio. I plan on using it only for side loading(it is a LOB app). It doesn't have any errors. But when I try to package it, I get the following errors. Errors in Packaging > 0X8007000b an attempt was made to load [...] read more
c#
uwp
visual-studio-2017
packaging
0votes
1answer

Trouble adding my Visual-C++ DLL to my VB.NET windows forms GUI app

Windows 10 and Visual Studio 2017. To reference the DLL in the VB.NET project: I DID vb.net project properties > Add > Reference > Browse > my DLL in project directory of this vb.net project > Add > checkmark DLL > OK ...and I get this error: "A reference [.dll] [...] read more
.net
vb.net
visual-studio
visual-c++
dll
0votes
0answers

Issue with Assembly dependency on MVC application

I have an MVC application => A , and I have a service project inside =>B the same. B is build in platform target as anycpu. and A project also with the same platform target. I have added a new project => C which is build in x86 platform. I [...] read more
c#
c++
.net
asp.net-mvc
0votes
1answer

Adxstudio ver 7.0.0023, An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

After I upgraded to Adxstudio from 7.0.0022 to 7.0.0023, I got the following error when doing global searches. I was running the site locally from an IIS express. I have updated all CRM solutions and dll libraries. Have any of you had this problem also before? Any known fixes? Thanks! [...] read more
dynamics-crm
adxstudio-portals
0votes
0answers

An attempt was made to load a program with an incorrect format after deploy

I'm facing this error after deploy on GoDaddy: > An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) Here are the full details of the error. I'm using Smartstore.net and it works perfect at local. What could be causing this error? read more
asp.net
asp.net-mvc
0votes
1answer

System.BadImageFormatException when getting the AssemblyVersion

So Im trying to implement a auto-updater for my application, from this thread. I've uploaded my setup file to my server and when Im trying to get the AssemblyVersion of the file I get System.BadImageFormatException, more exactly: System.BadImageFormatException occurred HResult=0x8007000B Message=Det går inte att läsa in filen eller sammansättningen Setup1.msi [...] read more
c#
0votes
0answers

C# WebP image throwing error "An attempt was made to load a program with an incorrect format."

I am try to convert jpeg image to webp format. like below in console application using (Image image = Image.FromFile("Capture.jpg")) { Bitmap bitmap = new Bitmap(image); WebPFormat.SaveToFile("image.webp", bitmap); } Reference from here http://webp.codeplex.com/ Below details of error > Error: An unhandled exception of type 'System.BadImageFormatException' occurred in Noesis.Drawing.Imaging.WebP.dll Additional information: [...] read more
c#
webp
0votes
0answers

LibGit2Sharp throwing exception in Azure App Service

I have a .NET 4.6 web app running in an Azure App Service in 64 bit. When I hit a controller that calls LibGit2Sharp, I get the following exception: [BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)] And this is the [...] read more
c#
azure
libgit2sharp
azure-web-app-service
azure-app-service-plans
-1votes
1answer

The app manifest publisher name (CN={digits}) must match the subject name of the signing certificate (CN=anton)

error 0x8007000B: The app manifest publisher name (CN=563776A1-7D2D-4E8E-AFE2-XXXXXX) must match the subject name of the signing certificate (CN=anton). I have searched all over the web and I get answer such as "you have to make sure that the Publisher name (in the AppxManifest.xml file) is the same as the certificate's [...] read more
uwp
-1votes
1answer

VB.NET calling a function in non-.NET Visual-C++ DLL gets 'An attempt was made to load a program with an incorrect format.'

Am using: Windows 10 64-bit and Visual Studio 2017 Pro. I built a Visual-C++ DLL. config=active(Debug) Platform=Active(Win32) Platform_Target=Windows10 I also built a VB.NET windows forms GUI. config=active(Debug) Platform=Active(Any CPU) Target_CPU=Any CPU .NET 4.5.1 DLL has this empty function: extern "C" BASICDLL_API void __stdcall test_empty_function(void) { } VB.NET has this DLL [...] read more
.net
vb.net
visual-c++
dll
-1votes
1answer

Could not load file or assembly 'Oracle.DataAccess'. no other solutions found

Simply this problem while trying to run my code. Any help please? > Server Error in '/' Application. Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format. Description: An unhandled exception occurred during the execution [...] read more
c#
.net
oracle
visual-studio-2015
-1votes
1answer

How to integrate Graph Engine with C# application

An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) The type initializer for 'Trinity.Global' threw an exception. read more
graphengine
-2votes
1answer

Why 0x8007000B on one Windows 10 Home PC and not on Another

I have a program that is meant for mix platforms. I have tested the same install able on Win 7 Pro 64 bit Win 10 Pro 64 bit Win 8.1 Pro 64 bit Win 10 upgraded from the above 8.1 Dozens of users have various flavors of Win 7. But: [...] read more
c#
c++
windows
-2votes
4answers

Twain scanner works fine on 32-bit but not on 64-bit

I'm using this example for scan twain .NET TWAIN image scanner But when I try running my project on a 64-bit system, its giving me this error: > An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) According to many searches that I [...] read more
c#
twain

Comments

Leave a comment

(plain text only)

Sources

  1. winerror.h from Windows SDK 10.0.14393.0
  2. https://github.com/dotnet/coreclr/blob/v1.1.0/src/inc/corerror.xml
  3. https://msdn.microsoft.com/en-us/library/cc231198.aspx

User contributions licensed under CC BY-SA 3.0