I, like many others, am converting a .Net 3.5 WIX installer project to 
.Net 4.0.  I have a custom action in my project that runs on uninstall 
and is failing with the familiar "bad image format" exception:

System.BadImageFormatException: Could not load file or assembly 
'ABC.Wix.CustomActions' or one of its dependencies. This assembly is 
built by a runtime newer than the currently loaded runtime and cannot be 
loaded.

As far as I can tell, I have performed all the right steps in order for 
this to work (details below).  However, I am wondering if the fact that 
this custom action runs on uninstall has anything to do with it.  I'd 
appreciate any insight into this instance of the problem.


My config file for the custom actions assembly appears to be correct 
based on the experience of all the others out there who have had similar 
problems:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
</startup>
</configuration>

As far as I can tell from the IDE's build output, the custom action is 
getting packaged correctly:

------ Rebuild All started: Project: ABC.Wix.CustomActions, 
Configuration: Release x86 ------
   Searching for custom action entry points in ABC.Wix.CustomActions.dll
       Loaded dependent assembly: C:\Program Files\Windows Installer XML 
v3.5\SDK\Microsoft.Deployment.WindowsInstaller.dll
       
InstallClientConfigurationFiles=ABC.Wix.CustomActions!ABC.Wix.CustomActions.ClientFiles.InstallClientConfigurationFiles
       
BackUpClientConfigurationFiles=ABC.Wix.CustomActions!ABC.Wix.CustomActions.ClientFiles.BackUpClientConfigurationFiles
       
BrowseForFileName=ABC.Wix.CustomActions!ABC.Wix.CustomActions.ClientFiles.BrowseForFileName
   Searching for an embedded UI class in ABC.Wix.CustomActions.dll
   Modifying SfxCA.dll stub
   Copying file version info from 
S:\Application\ABC.Wix.CustomActions\obj\x86\Release\ABC.Wix.CustomActions.dll 
to 
S:\Application\ABC.Wix.CustomActions\obj\x86\Release\ABC.Wix.CustomActions.CA.dll
   Packaging files
       ABC.Wix.CustomActions.dll
       ABC.InstallerCustomAction.Common.dll
       Microsoft.Deployment.WindowsInstaller.dll
       ABC.Wix.CustomActions.config
   MakeSfxCA finished: 
S:\Application\ABC.Wix.CustomActions\obj\x86\Release\ABC.Wix.CustomActions.CA.dll
   ABC.Wix.CustomActions -> 
S:\Application\bin\Release\ABC.Wix.CustomActions.dll

I have .Net 4.0 installed on my test machine.

The assembly binding output is as follows:

*** Assembly Binder Log Entry  (3/2/2011 @ 5:06:47 PM) ***

The operation failed.
Bind result: hr = 0x8013101b. No description available.

Assembly manager loaded from:  
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable  C:\WINDOWS\system32\rundll32.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = CLEARVIEWEDGE\mshurtleff
LOG: DisplayName = CVE.Wix.CustomActions
  (Partial)
LOG: Appbase = file:///C:/WINDOWS/Installer/MSI5214.tmp-
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = rundll32.exe
Calling assembly : Microsoft.Deployment.WindowsInstaller, 
Version=3.0.0.0, Culture=neutral, PublicKeyToken=ce35f76fcda82bad.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from 
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, 
custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL 
file:///C:/WINDOWS/Installer/MSI5214.tmp-/CVE.Wix.CustomActions.DLL.
LOG: Assembly download was successful. Attempting setup of file: 
C:\WINDOWS\Installer\MSI5214.tmp-\CVE.Wix.CustomActions.dll
LOG: Entering run-from-source setup phase.
ERR: Error extracting manifest import from file (hr = 0x8013101b).
ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing 
terminated.


-- 
Mary Shurtleff
Technical Lead
ClearViewEdge, LLC
13 Berkshire Road
Sandy Hook, CT 06482
1-800-304-9440 x102
www.clearviewedge.com

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to