在 Visual C# 2008 Express Edition 中设置 32 位 x86 构建目标? [英] Setting 32-bit x86 build target in Visual C# 2008 Express Edition?

查看:32
本文介绍了在 Visual C# 2008 Express Edition 中设置 32 位 x86 构建目标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个加载 32 位 COM dll 的 C# 应用程序.编译后的应用程序在 32 位 Windows 上运行良好,但在 64 位 Windows 上运行失败,因为它无法加载 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?

或者,有没有办法强制编译到 AnyCPU 构建目标的 .NET 应用程序在 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 头文件中设置一个标志,以向 .Net 发出信号,表明它应该以 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆