You (often) can use the same source code. However, each must be compiled to
target the appropriate framework, Desktop or Compact.
You cannot do what you want. In general, the underlying microprocessor uses
a different machine language, and while the IL (Intermediate Language) that
Visual Studio compiles to may be interchangeable, the IL itself is compiled
into machine code before it is executed. This step is not intended to be
done at runtime, though JIT compilation may be used.
Also, the Compact Framework (as its name implies) is a subset of the full
framework on the Desktop. So, it is quite possible to use Desktop framework
types that are not included in the Compact Framework. And, there is no rule
that says that the IL for the Desktop and Compact Frameworks will be,
exactly, identical. I suspect, without actual knowledge to state this with
certainty, that there can be minor differences due to optimizations made for
each platform. The compilation process, naturally, validates the used of
the appropriate framework types vs. the target framework.
Dick
--
Richard Grier, Consultant, Hard & Software 12962 West Louisiana Avenue
Lakewood, CO 80228 303-986-2179 (voice) Homepage:
www.hardandsoftware.net
Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004, Revised July
2006.