views:

104

answers:

1

I have written a tool that references Microsoft.TeamFoundation.VersionControl.Client.dll, which is a 32-bit DLL.

When I build my tool on 64-bit Windows, I set Visual Studio to specifically target X86 in order to force it to a 32-bit build.

Targetting X86 instead of All-CPU's prevents me from getting a BadImageFormatException, as long as I invoke the tool directly (e.g. by typing "myTool.exe" on the command line). However, if I run a batch file that invokes the tool, I still get the exception. This happens even if the batch file runs in a 32-bit command prompt (%WINDIR%\SysWOW64\cmd.exe).

What else can I do to make this work?

A: 

Since it is a 64-bit machine you are running the command line on, it is in 64-bit. Here is how you open and run a 32-bit command line:

http://www.tipandtrick.net/2008/how-to-open-and-run-32-bit-command-prompt-in-64-bit-x64-windows/

I would check these too:

http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework/topic46570.aspx and http://filips.net/archives/2008/01/17/getting-badimageformatexception-in-64-bit-windows/

Kevin
Quoting myself: "This happens even if the batch file runs in a 32-bit command prompt (%WINDIR%\SysWOW64\cmd.exe)."
Neil Whitaker
Thanks for trying to help. The other links just tell me what I already know and already tried. But I do appreciate you taking the time to answer.
Neil Whitaker