64-Bit Custom Actions

May 22, 2015 at 5:28 PM
Edited May 22, 2015 at 6:22 PM
I'm having a difficult time getting our custom actions to execute under a 64-Bit configuration.

setup.msi /L*V out.log is reporting:

...
MSI (s) (B4:B0) [14:20:45:114]: Hello, I'm your 32bit Elevated custom action server.
...
...
Error: could not load custom action class Company.Wix.CustomActions from assembly: setup
System.BadImageFormatException: Could not load file or assembly 'setup' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'setup'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.AppDomain.Load(String assemblyString)
at Microsoft.Deployment.WindowsInstaller.CustomActionProxy.GetCustomActionMethod(Session session, String assemblyName, String className, String methodName)

Any thoughts?
May 22, 2015 at 8:53 PM
Correct me if I'm wrong here, but it looks like WixSharp is always using MakeSfxCA.exe using Utils.PathCombine(WixSdkLocation, @"x86\sfxca.dll").
Coordinator
May 23, 2015 at 11:30 AM
Thank you. Good pick. The compiler was hardcoded to the x86 dir.
Logged as Issue #38
Fixed in changeset #c5de045c6cb9.

The following assignment will trigger packing ManagedActions as x64
project.Platform = Platform.x64;  
The fix will be available in the next release. Though the binaries are available now from git.
May 27, 2015 at 2:52 PM
Changeset #c5de045c6cb9 looks good. x64 custom actions now work as expected. This might be coincidental, but thanks for the quick turnaround on release v1.0.20.0. Really good job. Not to inflate your ego or anything, but your cs-script / wixsharp products are impressive. Thanks again.
Coordinator
May 28, 2015 at 1:03 AM
No worries, my ego is safe :)