views:

306

answers:

7

Generally speaking, Will a .net winforms application work in a 64-bit OS or does it need to be modified?

+1  A: 

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.

heavyd
+5  A: 

If it doesn't rely on a 32 bit external library (e.g. 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.

Mehrdad Afshari
+1  A: 

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 PInvoke calls, you may need to update your application for a 64 bit environment.

JaredPar
A: 

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.

TheTXI
+5  A: 

Most .NET applications should work unmodified in 64 bits if they target x86 instead of Any CPU which is the VS.NET default.

Do you mean: "if they /don't/ target x86 instead of ...". Targeting only x86 would create a problem.
Richard
@Richard: No, jsimas is correct. If you only target x86, your app will run on 64 bit OS as a 32 bit process (just like a native x86 exe running on 64 bit Windows). It'll have pretty much the same environment as if it were run on a 32 bit OS.
Mehrdad Afshari
A: 

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.

+1  A: 

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.

Groo