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

434votes
16answers

"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
64-bit
pinvoke
32-bit
badimageformatexception
92votes
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
59votes
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
64-bit
33votes
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
32votes
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
24votes
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
64-bit
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
64-bit
13votes
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
64-bit
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
2answers

UWP appx package 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
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
sqlite
6votes
5answers

Alternate cause of BadImageFormatException in .NET Assembly?

I'm working on a .NET 3.5 console application in C# which uses a VC++ unmanaged DLL. It ran without a problem when I worked on it a few weeks ago, but I'm coming back to it today and am now getting a BadImageFormatException ("An attempt was made to load a [...] read more
c#
c++
visual-studio
visual-studio-2008
dllimport
6votes
4answers

Using C++ DLL in C# project

I got a C++ dll which has to be integrated in a C# project. I think I found the correct way to do it, but calling the dll gives me this error: System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) This [...] read more
c#
c++
dll
dllimport
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
4votes
2answers

Trying to run EF Code first Migrate.exe tool on production environment failed

I'm using EntityFramework version 6.1.3. I copied migrate.exe from EntityFramework version 6.1.3 package tool folder to bin folder of my website. My web site is compiled and published to production environment with x86 CPU and target framework 4.5.1 I run the following command: > D:\Sites\MatrixPortal\bin>migrate.exe d:\sites\MatrixPortal\bin\MatrixPortal.BL.dll /startUpDirectory="d:\Sites\MatrixPortal\bin" /startUpConfigurationFile="d:\Sites\MatrixPortal\Web.config" and i [...] read more
entity-framework
ef-migrations
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 this 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
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
3answers

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
1answer

how to call a C++ dll from C# windows application project

I have created a dll in C++ using a Class Library project in Visual Studio. I need to call a method in the dll from a C# application. I got to know there are 2 approches. One is to add the dll project reference to C# project or use DllExport [...] read more
c#
exception
visual-c++
dllimport
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
64-bit
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
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

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

Error in Importing "Interop.zkemkeeper.dll" to WCF Service

I have "WCF Service Application" which is .net framework 4.6.1. I need to add "Interop.zkemkeeper.dll" as a reference. but when I added this as reference to the WCF service and when service stated it shows following error on the browser. "Server Error in '/' Application. Could not load file or [...] read more
c#
wcf
visual-studio-2017
zkteco
2votes
1answer

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
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

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
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
3answers

Win32 DLL not found error in Azure Web Application

I have a web application which is hosted in Azure. When I run the app and authenticate the user, I am getting the error "One of the dependent DLL not found". Background: In the web application, I am using fingerprint scanner functionality to capture a fingerprint image. To capture fingerprint [...] read more
c#
azure
asp.net-core
azure-web-sites
paas
1vote
0answers

"UWPHost.pdb not loaded" - Debugging Xamarin UWP app

I have a Xamarin app for which I have been debugging the UWP app on my computer for testing. I've been having difficulties debugging. I keep getting a 'No Symbols Loaded' error which goes onto say one of the following errors: > UWPHost.pdb not loaded or > wkernelbase.pdb not loaded [...] read more
visual-studio
xamarin
visual-studio-debugging
1vote
0answers

Why does downgrading my framework version and then upgrading again allow this .dll to load properly?

I am trying to automate some data collection using an Oscilloscope. I have a USB scope with plenty of examples. The examples worked just fine, but when I tried to create my own project things stopped working. I have mirrored their setup with respect to the .dll location and which [...] read more
c#
.net
1vote
0answers

C# Generic DynamicMethod with no type parameters

For performance reasons, I am trying to write an IL delegate that can return a random KeyValuePair from a dictionary without having to use enumeration. To do this, I am directly reading from the dictionary's _bucket and _entries fields. Dictionary is a generic collection, but I would like to avoid [...] read more
c#
delegates
cil
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
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
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
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
1answer

Generate call to generic method in runtime

Goal: generate method like this in runtime: public void InsertOnSubmit<T>(IQueryable<T> q, T o) where T : class, new() { (q as Table<T>).InsertOnSubmit(o); } My current code for this is: var tb = mb.DefineType("DatabaseDataRepository"); // define & implement other methods, etc /* Define InsertOnSubmit<> method */ var insertOnSubmitMethod = tb.DefineMethod("InsertOnSubmit", MethodAttributes.Public [...] read more
c#
generics
reflection.emit
0votes
0answers

ImageResizer: System.BadImageFormatException is causing Web app crash despite being in try ... catch

A user uploaded a PNG file which looks as if it is corrupted in some way. But the biggest problem is that any time our system tries to thumbnail it the entire app pool crashes and restarts. I've tried it using a direct URL and using code inside a try [...] read more
png
imageresizer
0votes
1answer

Problem instaling outlook add-in in Office 2013

I am developing an add-in for outlook that references other libraries. It is supposed to work in Office 2013 and 2016 but in 2013 it does not work. Showing the errors the only thing I found is this: LOG: This bind starts in default load context. LOG: Using application configuration [...] read more
outlook
outlook-addin
outlook-2013
0votes
1answer

Microsoft Dynamics NAV instance running after windows restart but not responding

I've got issue with Microsoft Dynamics NAV instance. We're restarting Windows server each night (I know that we probably shouldn't do it, but this is a separated topic and not the point of this question). After windows server starts, SQL and Dynamics Nav instances are starting. Sometimes (1-2 times per [...] read more
microsoft-dynamics
dynamics-nav
microsoft-dynamics-nav
0votes
0answers

Building a Unity UWP/WSA from Command Line with Non-Test Certificate

I'm having an issue with building my Unity project through the command line with a certificate I got from Sectigo Limited with Code Signing. The reason why I went with getting a Sectigo Limited certificate instead of getting certified through the Windows Store is because we plan on the users [...] read more
c#
unity3d
command-line
certificate
win-universal-app
0votes
3answers

Unable to Call Simple Custom Dll Import from C# Application

Update I have now run through the tutorial 3 times with the same results (Visual Studio/Windows is unable to recognise the DLL as a valid file). This must be an issue with my environment, as mike below ran through the tutorial and it worked fine. I did notice this in [...] read more
c#
c++
0votes
1answer

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

Start Bass with UWP

I found an example of UWP visualizer in this link but after I choose the audio file from the FilePicker and the Bass should start it returns an error: Attempt to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B), when Bass should start. public async Task Play() [...] read more
c#
uwp
bass
0votes
0answers

Error signing Electron package using Code signing certificate

We exported .exe and followed process as defined here https://electronjs.org/docs/tutorial/windows-store-guide, after that I configured and used electron-windows-store to export .appx and sign that. We have purchased code signing certificate form Godaddy. I exported pfx s defined here https://au.godaddy.com/help/windows-install-codedriver-signing-certificate-and-create-pfx-file-2698?locale=en . Check my request for exporting appx signing that below. > > [...] read more
electron
windows-store-apps
code-signing-certificate
0votes
1answer

BadImageFormatException 0x8007000B only on Windows Server 2012 R2

I have a ASP.NET 3.5 application that includes a 32-bit DLL. It works fine (and has for years) on Windows XP, 7 and 10. I am adding support for Windows 2012, 2012 R2 and 2016. It works on 2016, but does not work on 2012 R2. At the first call [...] read more
iis
windows-server-2012
0votes
0answers

PdfiumViewer Pdfium Exception - VS2017 Created Project must be .Net 4.0 and then upgrade to any higher versions

VS2017 ver 15.9.3 NuGet Packages PdfiumViewer version="2.13.0.0" PdfiumViewer.Native.x86_64.v8-xfa version="2018.4.8.256" TEST SCENARIO - LOAD PDF FILE WITH PDFIUMVIEWER 1. Create Project1: Target Framework = .Net Framework 4. Program runs successfully. 2. Change Project1 to any higher Framework - 4.5, 4.5, 4.6 ... 4.72 Program runs successfully 3. Create Project2: Target Framework [...] read more
c#
pdf
rendering
pdf-viewer
pdfium
0votes
1answer

Using mingW compiled dll in VS2017

this topic certainly doesn't look 'new' but after reading a number of posts, blogs and comments, I'm still none the wiser, and can't get my test application working. From an implementation point of view I must compile the dll with mingW (when other MSVC compilers are used, the error count [...] read more
c#
c++
visual-c++
mingw
dji-sdk
0votes
3answers

C++ DLL imported into a C# application

I am trying to do a basic C++ DLL in order to use it in C#.. the following classes are used: My cpp file #include "stdafx.h" #include "MathFuncsAssembly.h" namespace MathFuncs { double MyMathFuncs::Add(double a, double b) { return a + b; } double MyMathFuncs::Subtract(double a, double b) { return a [...] read more
c#
c++
visual-studio
visual-c++
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

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

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
-1votes
1answer

Connection error to Azure SQL Database when running .Net Core console app as Azure webjob

I have .Net Core console app that connects to Azure SQL database using entity framework. Every think works fine locally but when I created publish package using this command line > dotnet publish -c Release -r win-x64 --self-contained false Zipped it and upload it and used it in Azure webjob [...] read more
azure
.net-core
azure-sql-database
azure-webjobs
webjob
-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
-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

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