简体   繁体   中英

Will a .NET Windows Forms application work in a 64-bit OS or does it need to be modified?

一般来说,.NET Windows Forms应用程序是否可以在64位操作系统中运行,还是需要进行修改?

If it doesn't rely on a 32 bit external library (eg COM component), it'll work perfectly as a 64 bit process and will leverage its benefits (large address space, x64 instruction set, ...). If it relies on 32 bit stuff, most of the time, you can still run it as a 32 bit application by setting the target platform to x86.

如果大多数.NET应用程序以x86而不是任何VS(默认为VS.NET)为目标而应该以64位为单位进行修改。

According to this link: MSDN - Migrating 32-bit Managed Code to 64-bit .

If you have 100% type safe managed code then you really can just copy it to the 64-bit platform and run it successfully under the 64-bit CLR.

But if you are using any of the following features:

  • Invoking platform APIs via p/invoke
  • Invoking COM objects
  • Making use of unsafe code
  • Using marshaling as a mechanism for sharing information
  • Using serialization as a way of persisting state

it indicates that the application might not be completely compatible.

For the most part it should work just fine. You should be careful if you are doing anything with native code, whether it be unsafe managed code, or interop/PInvoke, but if all of your code is managed you shouldn't have any problems.

A pure .NET application will run on a 64-bit operating system with no modifications.

If you use a C++/CLI library, use architecture specific COM components, or do any P/Invoke calls, you may need to update your application for a 64-bit environment.

Most 64-bit OS's are able to handle 32-bit apps without problems. This is why you see a Program Files (x86) folder on your 64-bit OS to handle a lot of your old 32-bit apps.

As long as you don't mix and match library platforms, you'll be fine. Target x86 when you compile and you should be good to go.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM