Generally speaking, Will a .net winforms application work in a 64-bit OS or does it need to be modified?
views:
306answers:
7For 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.
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.
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.
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.
Most .NET applications should work unmodified in 64 bits if they target x86 instead of Any CPU which is the VS.NET default.
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.