开发者

How to correctly load 32-bit DLL dependencies when running a program from a batch file

开发者 https://www.devze.com 2022-12-29 18:49 出处:网络
I have written a tool that references Microsoft.TeamFoundation.VersionControl.Client.dll, which is a 32-bit DLL.

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 开发者_如何学JAVAbuild.

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?


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/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号