I recently inherited a project that uses Microsoft Enterprise Library, albeit that it uses source code instead of binaries. Yuck. I spent a lot of time trying to fix compatibility issues with x86 vs. x64.
In the end, I did manage to get it working. The major issue I ran into was an exception in the
Could not load type 'Microsoft.ApplicationBlocks.Updater.Downloaders.BG_BASIC_CREDENTIALS' from assembly 'Microsoft.ApplicationBlocks.Updater.Downloaders, Version=22.214.171.124, Culture=neutral, PublicKeyToken=null' because it contains an object field at offset 4 that is incorrectly aligned or overlapped by a non-object field.
As it turns out, this is a unique x64 problem. Essentially, the struct in question uses a space of 4 bytes, which is correct for 32-bit machines. On 64-bit machines, it needs to be eight bytes.
We can easily update the relevant class, like so:
/// [StructLayout(LayoutKind.Explicit, Size=8, Pack=4)]
internal struct BG_BASIC_CREDENTIALS
public string UserName;
public string Password;
Tada, instant success! The exception disappears, and everything proceeds on as expected.