简体   繁体   English

如何在64位操作系统上运行.Net Win-Forms应用程序?

[英]How to run .Net Win-Forms application on a 64 Bit OS?


I have made a .Net win-forms application in C#, on a 32 bit OS (Windows 7). 我已经在32位OS(Windows 7)上用C#制作了.Net Win-forms应用程序。
It doesn't work on the deployed client-terminal/machine which has a 64 bit OS (Server 2008). 它不适用于已部署的具有64位OS(Server 2008)的客户端/计算机。

What should I do? 我该怎么办?

Thank you. 谢谢。

Go to the Build tab of the project's properties and make sure the platform target is set to x86 . 转到项目属性的“ 构建”选项卡,并确保平台目标设置为x86 (This is just my first guess based on the vague information provided. The problem might be caused by something completely else, eg the terminal server environment as such.) (这只是我根据所提供的模糊信息做出的第一个猜测。问题可能是完全由其他因素引起的,例如终端服务器环境。)

You should only change this setting if you need your application to address a large amount of memory or you definitely want to make sure it runs as a 64-bit process. 仅当需要应用程序来处理大量内存或肯定要确保它作为64位进程运行时,才应更改此设置。

The AnyCPU setting can hardly be recommended as it may cause you all sorts of pain with respect to native dependencies (I'm not saying it should never be used, but it should be very well considered whether the additional overhead required for deployment and testing is worth the trouble). 几乎不建议使用AnyCPU设置,因为它可能会引起您对本机依赖项的种种痛苦(我并不是说永远不要使用它,但是应该很好地考虑是否需要部署和测试所需的额外开销)值得的麻烦)。

Probably you have used some feature that is not available while running the app in x64. 可能您使用了某些在x64中运行应用程序时不可用的功能。 Change the build configuration to x86. 将构建配置更改为x86。

If it does work now, you have used some libraries (COM, ActiveX, Office 2007, WinAPI, ...) that does not like to be called from 64 bit. 如果现在可以正常运行,则说明您使用了一些不喜欢从64位调用的库(COM,ActiveX,Office 2007,WinAPI等)。

If it works now, ask yourself: why do I want my app to run using x64 bit? 如果现在可以使用,请问自己:为什么我要让我的应用程序使用x64位运行? What do I gain? 我会得到什么? Does it really need to use that much memory? 是否真的需要使用那么多内存?

There is no problem with running a x86 bit app on a x64 bit platform. 在x64位平台上运行x86位应用程序没有问题。

如果您在应用程序内部使用ActiveX控件或其他无法移植到x64的对象,则可能必须将构建目标更改为“ x86”。

If it's a genuine x86 application your x64 environment shouldn't have any problem running it. 如果它是真正的x86应用程序,则x64环境在运行它时不会有任何问题。 So make sure all your libraries and your own binary are x86 compatible and don't use x86 exclusive features like specific COM libraries. 因此,请确保所有库和您自己的二进制文件都与x86兼容,并且不要使用特定COM库之类的x86独有功能。

You should ensure that you project is being built with the "Any CPU" platform. 您应该确保使用“ Any CPU”平台构建项目。

The default is sometimes to build for "x86". 有时默认值为“ x86”。

Check your build config. 检查您的构建配置。 I think VS will default to building the app for x86 platforms if you develop in a 32-bit environment. 我认为,如果您在32位环境中进行开发,VS将默认为x86平台构建应用程序。 Either change to x64 or AnyCPU, rebuild and try again. 更改为x64或AnyCPU,重新生成并重试。

.stompp .stompp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在C#Win-Forms中动态填充(运行时)数据网格视图 - How to fill Data Grid View dynamically (run time) in C# Win-Forms .NET Windows窗体应用程序是否可以在64位操作系统中运行,还是需要进行修改? - Will a .NET Windows Forms application work in a 64-bit OS or does it need to be modified? 32位winform应用程序不能在64位操作系统上运行 - 32 bit winform application doesn't run on 64 bit OS 如何编译32位(我的操作系统是64位) - 错误exe不是一个有效的Win32应用程序 - How to compile 32-bit (my OS is 64-bit) - Error exe is not a valid Win32 application c#.net 32​​位应用程序无法在64位操作系统上运行 - c#.net 32 bit application Not working on 64 bit OS Visual Studio C#Win-Forms应用程序Web浏览器加载非常慢 - Visual Studio C# Win-Forms Application webbrowser loading very slow 如何在64位应用程序中使用win 32位dll - how to use win 32 bit dll in 64 bit application C# .net 应用程序 openfile 对话框在 win xp 中工作而不在 win 7 中(32 位或 64 位) - C# .net application openfile Dialog works in win xp not in win 7 (32 bit or 64 bit) 如何在win-forms C#中的串口中发送和接收数据 - How to Send & Receive data in Serial-port in win-forms C# 如何在64位计算机上运行64位Web应用程序 - How to run a 64 bit web application on a 64bit machine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM