Error loading 32-bit PoshWpf.dll on 64-bit OS

Oct 8, 2010 at 5:27 PM

I'm using the latest version of the PowerBoots files, 0.2.1.0, on Windows 7 64-bit. When I call Import-Module PowerBoots, it works fine from a 64-bit PowerShell console, but from a 32-bit one, I get this error:

C:\Public\Technologies\PowerShell> Import-Module PowerBoots
Import-Module : Could not load file or assembly 'file:///C:\Users\Chuck\Documents\WindowsPowerShell\Modules\PowerBoots\BinaryAssemblies\PoshWpf.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
At line:1 char:14
+ Import-Module <<<<  PowerBoots
    + CategoryInfo          : NotSpecified: (:) [Import-Module], BadImageFormatException
    + FullyQualifiedErrorId : System.BadImageFormatException,Microsoft.PowerShell.Commands.ImportModuleCommand

I believe this is the type of error you get when trying to load a 64-bit DLL into a 32-bit process. I'm using the version of PoshWpf.dll that was shipped, not the 3.5 or 4.0 one. I made no changes to the downloaded files except I had to strip the Authenticode signature out of the script files. I also removed the internet block on the zip file before extracting the files.

Any suggestions on how to fix this problem?
Thanks.

Coordinator
Oct 8, 2010 at 6:19 PM

If you're using the released package, you need to download a 32bit version if you want it to work in a 32bit host -- there's no way around that (you can just use the 32bit version -- it will work anywhere, and there's probably no benefit to using the 64bit version).

In fact, in source control I've stopped bothering with the 64bit dll -- if you download the latest changeset using the link on the right-hand side, you'll find I included a PoshWpf.dll.AnyCPU.Net35 and PoshWpf.dll.AnyCPU.Net4 and you can just rename whichever is appropriate for ya.

Oct 8, 2010 at 6:31 PM

I don't see a separate 32-bit version of the PoshWpf 2.0 DLL in the download. Are you saying that I need to use either the 3.5 or 4.0 one in order to get that functionality?

Coordinator
Oct 8, 2010 at 6:42 PM

I'm sorry. You're right! I was confusing the download situation with my other project which creates and also uses the PoshWpf dll, over there I pushed separate x86 and x64 and .Net4 and .Net35 builds ...

So, uhm ... right now I'm going to have to go with: download the latest changeset, it's a better quality anyway!

FYI: The only reason I haven't released the current changeset as a release is that I've been waiting to hear back from someone about a possible rename/reboot of the project which would make a new release more exciting ;)  But I guess I need to get that discussion kicked into high gear. I apologize for any inconvenience this is causing.

Oct 8, 2010 at 6:45 PM

I'm still confused, I'm using the latest changeset, 1b30dc1c7128, which only has one version of the DLLs.

Coordinator
Oct 8, 2010 at 6:52 PM

If you look in Modules\PowerBoots\BinaryAssemblies ...

There should be a file named PoshWpf.dll.AnyCPU.Net35 which you can rename to PoshWpf.dll

Oct 8, 2010 at 6:57 PM

OK, that works, I guess what I was trying to say was that there's no AnyCPU version of PoshWpf.dll that's compatible with .NET 2.0. But since Windows 7 ships with .NET 3.5 installed, this shouldn't be a problem for me.

Thanks for helping me out so promptly, Jaykul!

Coordinator
Oct 8, 2010 at 11:15 PM

Glad I could help :)

Actually, .Net Framework 2.0 isn't supported of course, because it didn't even have WPF. The .Net35 version is compatible with "CLRVersion" 2.0 as long as you're actually at framework 3 or so ...

And honestly, considering the great strides that have been made in WPF speed and text-rendering in both .Net35 and .Net4, I highly recommend that you run as upgraded as possible :)

In fact, there are a few features and commands in the .Net4 version which don't work in 3.5 (but I'll get into those more when I'm ready to actually release it).