在Visual C#2008 Express Edition中设置32位x86构建目标? [英] Setting 32-bit x86 build target in Visual C# 2008 Express Edition?
问题描述
我正在建立一个C#应用程序加载32位COM DLL。编译的应用程序在32位Windows上运行良好,但在64位Windows上运行的是barfs,因为它无法加载32位COM。有没有办法在VC#2008 Express Edition中设置32位构建目标?
I'm building a C# application that loads a 32-bit COM dll. The compiled application runs fine on 32-bit Windows but barfs on 64 bit Windows because it can't load the 32-bit COM. Is there a way to set a 32-bit build target in VC# 2008 Express Edition?
或者,有一种方法可以强制将.NET应用程序编译为 AnyCPU 构建目标以在64位Windows上以32位模式运行?
Alternatively, is there a way to force a .NET application compiled to the AnyCPU build target to run in 32-bit mode on 64-bit Windows?
推荐答案
在VS Express中的UI中将其设置为32位,但显然(我只有专业版本),可以使用一些设置完成。 此论坛帖子有如何执行的详细信息。
You cannot explicitly set it to 32-bit in the UI in VS Express, but apparently (I only have the Professional version at hand) it can be done using a bit of setting up. This forum post has details on how to do it.
您还可以使用 CorFlags 工具,其中包含 .Net Framework SDK 将编译输出设置为32位运行。要使用CorFlags设置32位标志,请从命令行运行:
What you can also do is to use the CorFlags tool that comes with the .Net Framework SDK to set the compiled output to run as 32-bit. To set the 32-bit flag using CorFlags, run this from the command line:
CorFlags.exe /32BIT+ yourapp.exe
这将在您的exe的标题中设置一个标志,表明它应该运行32位。
This will set a flag in the header of your exe to signal to .Net that it should be run as 32-bit.
这篇关于在Visual C#2008 Express Edition中设置32位x86构建目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!