Conditionally compile a class for either desktop or handheld

Hi folks. As duplicate code is very bad, I'm trying to create a database component which could be referenced from either a PocketPC2003 app, or a traditional windows (desktop app).
Now I'm not expecting to be able to make a single DLL, but would like to be able to compile the same code to either platform.
I've got it down to the references in the project. I need to be able to switch from the desktop versions of 'System', 'System.data'. 'System.xml' to the handheld ones easily and error-free!
Any ideas?

[535 byte] By [Anarchy] at [2007-12-16]
# 1

You can create 2 projects, one for CF, another one for desktop and include same files into these projects. Next, define macro of your choice (say, DESKTOP) in one project and use conditional statements like this:

#if DESKTOP
// Desktop code here.
#else
// NETCF code here.
#endif

Also, please see this:

http://www.danielmoth.com/Blog/2004/09/share-code-if-fullframe_17.html
http://www.danielmoth.com/Blog/2004/09/retargetable-256.html

IlyaTumanov at 2007-9-9 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 2
Thanks Ilya, works fine
Anarchy at 2007-9-9 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...