If you don't really need a design-time experience for your control then just
compile it against the Compact Framework and it should be retargetable to
the Full Framework automagically. All you need to do is ensure that you're
using properties, methods, etc. that exist in both the Compact and Full
Framework. Keep in mind that when including the CF-based control in your
desktop project it will still want to link to the device version of
System.Windows.Forms, and any other reference that was included when
building the control. Since the device version of System.Windows.Forms will
be a dependency, the compiler may complain that you have things defined in
multiple locations (desktop System.Windows.Forms and device
System.Windows.Forms). So this solution is possible, but not very elegant.
So I would assume that you would want a design-time version of the control
not only to alleviate the raft of warnings that you'll get in this scenario
but also so that the end-developer will have a better visual experience.
In order to create a design-time version of your control that may be
included in the ToolBox of a device project you will need to use a special
attribute and follow some guidelines. Read through the information at the
following links.
http://msdn.microsoft.com/library/d..._evtuv/html/etconcustomcontroldevelopment.asp
http://msdn.microsoft.com/library/d...ngCustomControlForSmartDeviceApplications.asp
Typically controls in the Compact Framework are lighter-weight versions of
their desktop counterparts. So you might consider creating a full framework
control project and a device class library project. You can share the source
between the two projects (when adding the source file into the projects
choose the dropdown arrow on the Open button in the "Add Existing Item"
dialog box and selecting "Link File"), and then isolate desktop and device
specific code blocks using conditional compilation. Then, define the
appropriate conditional compilation constant in the project properties for
the desktop project and for the device project. This will allow you to
target the Full Framework and Compact Framework using the same source base
(but different assemblies), allow you to have a design-time experience for
the end-developer in either case, and also allow you to add lots of
functionality to the desktop version of the control while only supplying the
absolute necessary functionality in the device version to ensure that the
shipped run-time assembly is as small as possible, if desirable.
#if DESKTOP_ONLY
...
#endif
#if DEVICE_ONLY
...
#endif
HTH