Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How to One Visual C# solution on both 32bit project and 64bit project working?

What I have tried:

Not working both projects. There isn't any idea
Posted
Updated 11-May-16 21:03pm
v2
Comments
koolprasad2003 12-May-16 2:13am    
32 bit and 64 bit project ? do you mean to say processors ?
Sergey Alexandrovich Kryukov 12-May-16 2:49am    
You are right, these terms are inaccurate, but saying "processors" in this context won't be correct, too.
—SA

Develop project to the "AnyCPU" target, this is the best. Then it will work on any CPU architecture.

Strictly speaking, there is no such thing as "32-bit project" or "64-bit project" (and especially 64-bit, because x86-64 and IE64 are two different incompatible architectures, so there is even just 64-bit target).

The only reason to specify platform-specific target (not "AnyCPU") could be the use of some native (non-managed) module used in you assembly. And even if you use such module, in many cases working around the problem without breaking "AnyCPU" can be possible. You can have this module in version for different platform and not use it directly. Instead, you can P/Invoke cross-platform LoadLibrary and GetProcAddress and dynamically load appropriate version of the module, depending on the CPU architecture detected during runtime. This technique is pretty advanced, so I don't want to waste time for detailed explanation, unless you have some qualified follow-up questions on the topic.

It's also good to be aware of WoW64, which allows using x86 modules (32-bit) for different versions of OS on 64-bit CPU: WoW64 — Wikipedia, the free encyclopedia[^].

—SA
 
Share this answer
 
Comments
koolprasad2003 12-May-16 3:00am    
+5ed. Good Elaboration
Sergey Alexandrovich Kryukov 12-May-16 3:02am    
Thank you, Prasad.
—SA
You can compile your code with X86 and it works for both 32BIT and 64BIT processors.
As SA explained, WOW64 support 32 bit applications on 64bit machines
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900