Reference custom assembly as x86 using #r

I am aware that I can reference a custom assembly using #r "path/to/assembly.dll"

My question is that since the latest version of Workbooks I get a BadImageFormatException because it must be trying to load the 32-bit DLL into a 64-bit environment. Is there any way to force everything to 32-bit to load my custom DLL? This is a WPF workbook on Windows.

Thanks

Answers

  • SandyArmstrongSandyArmstrong USXamarin Team, Insider Xamurai

    Since 1.0, we changed the Windows workbook apps to be AnyCPU, but no longer preferring 32-bit. So you are correct: they are running as 64-bit processes.

    There is no good workaround for this right now. You could use CorFlags to modify the EXE (as described in https://lostechies.com/gabrielschenker/2009/10/21/force-net-application-to-run-in-32bit-process-on-64bit-os/ ), but that could cause other trouble down the line. FWIW, the EXE is something like C:\Program Files (x86)\Xamarin\Workbooks\WorkbookApps\WPF\Xamarin.Workbooks.Wpf.exe.

    Please file a bug if you'd like to see explicit 32-bit support in the future.

Sign In or Register to comment.