[wix-users] Bad Image Format Exception

Habib Salim habib at hsalim.com
Wed Nov 15 10:02:53 PST 2017


I finally figured it out.  the Custom Action project should use .Net
Framework 3.5 as the target framework.
(FW3.0 and 2.0 may also work; I haven't tried).  FW4.0 and above changes
the runtime to 4.0 causing the BadImageFormatException.

Hope that helps




-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf
Of Habib Salim via wix-users
Sent: Tuesday, November 14, 2017 9:08 AM
To: 'WiX Toolset Users Mailing List' <wix-users at lists.wixtoolset.org>
Cc: Habib Salim <habib at hsalim.com>
Subject: [wix-users] Bad Image Format Exception


Hi,

I have a custom action to create a few database objects.
This was working perfectly last week and I started adding a few more
functions and rebuilt the installer.
I got  BadImageFormatException and I just can't seem to get past it.  (see
detailed message below)


I reverted all the changes
Tried building the installer targeting the x86 platform, x64, Any CPU
In the config file for this project has        
<supportedRuntime version="v4.0" />
<supportedRuntime version="v2.0.50727"/>


I used Corflags.exe to verify that it was a 32bit dll, not 64bit

Nothing works.

I just cant figure it out.  please help.
Thanks
Habib






--------------------------------------------------------------
Calling custom action
WixDbInstall!HSalimCo.CustomActions.EnumerateSqlServers
Error: could not load custom action class HSalimCo.CustomActions from
assembly: WixDbInstall
System.BadImageFormatException: Could not load file or assembly
'WixDbInstall' or one of its dependencies. This assembly is built by a
runtime newer than the currently loaded runtime and cannot be loaded.
File name: 'WixDbInstall'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection)
   at System.Reflection.Assembly.InternalLoad(String assemblyString,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection)
   at System.AppDomain.Load(String assemblyString)
   at
Microsoft.Deployment.WindowsInstaller.CustomActionProxy.GetCustomActionMet
hod(Session session, String assemblyName, String className, String
methodName)

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant
http://www.firegiant.com/


More information about the wix-users mailing list