Ok. So let's go back and talk about the options. You have two ways to
approach this. In both situations you may want to think about how these
projects relate to each other. A solution is intended to group related
projects together. I assume by the fact that you stated that the DataObjects
project and the Multimedia project are not sharing code that these projects
are not really related. So you may consider placing each of the projects
into a separate solution - so that the DataObjects project is in one
solution by itself and the Multimedia project is in another solution by
itself. Then, to ensure that you don't run into any phantom issues you may
also want to place the Pocket PC project into it's own solution and Desktop
project into it's own solution as well. In total you would have four
projects and four solutions. This doesn't sound ideal but it could save you
some more frustration down the road. Now lets get to the options...
(1) You could build the DataObjects project and Multimedia project as smart
device class library projects. This would ensure that the resulting dll is
compiled against the CF. And, assuming that you're not using anything device
specific like the InputPanel component, then these assemblies will also be
usable on the desktop. One issue that you may run into, however, is that VS
may attempt to automatically pull in references when you add these
assemblies to the Desktop project. But I'm just going off of memory here. If
VS doesn't cause issues when adding a reference to the assemblies in your
Desktop project then this is the way that I'd go as it seems more logical to
share assemblies rather than share, or copy, code.
(2) You can create two project for each class lib. One for the desktop and
one for the device. So, and again understanding the phantom issues, you
would create a solution for the desktop DataObjects project and a solution
for the desktop Multimedia project and you would also create a solution for
the device DataObjects project and another solution for the device
Multimedia project. That's a lot of solutions, but what you could do is then
link the code into the projects between the desktop and device versions.
This may have been what you were doing before. At this point you would
differentiate any device and desktop specific code with conditional
compilation, defining the conditional compilation constants (or symbols) in
the appropriate project. This way would ensure that you are seeing proper
syntax highlighting as well as intellisense. Then you would add the correct
assembly (device or desktop) to the appropriate project (Pocket PC or
Desktop). This option gives you flexibility to add extra functionality that
is dependent on the full framework but yet share the bulk of the code
between the desktop and the device.
I guess it's up to you which one you choose, but if you don't need to do
anything specific to either the desktop or the device then I would attempt
the first option. If you do get jerked around by VS (which from memory is a
possibility when you attempt to add the assembly built against the CF as a
reference to the Desktop project) then the second option becomes the last
resort.
--
Tim Wilson
..NET Compact Framework MVP
Robert W. said:
Tim,
By asking me whether "both projects are smart device projects", which 2
projects are you referring to? "Pocket PC" is definitely a smart device
project but "Desktop" is a WinForms project.
There is no code shared between "DataObjects" and "Multimedia".
By end goal/hope here is to find a simple (and safe) way to be able to use
each of DataObjects and Multimedia within each of Desktop and Pocket PC.
Currently I can use some of the methods in each but things fail on the Pocket
PC if I try to use things like Images and DataSets.