Re: Sharing code between Smart Device Project and desktop project by Dan
Dan
Mon Sep 13 15:29:44 CDT 2004
Chris--
Thanks very much, but I'm not sure that follow. Are you saying that I can
compile a library against the desktop framework and then run that library on
a smart device, as long as I check the OS for those methods which are
implemented differently on the SmartDevice?
Dan
"Chris Tacke, eMVP" <ctacke@spamfree-opennetcf.org> wrote in message
news:uPMaNuamEHA.3392@TK2MSFTNGP15.phx.gbl...
> Right. Instead runtime checks should be done. A static constructor to
> check the current OS is the simplest method, then all methods can be
> redirected based on that check.
>
> -Chris
>
>
> "Dan" <dan@dontspamme.com> wrote in message
> news:%23fxgbaamEHA.4064@TK2MSFTNGP14.phx.gbl...
> > Thanks for the conditional compile advice. However, I think there's a
> > problem with answer 2: "YourAppLibrary" also will need to be compiled
as
> > both a Desktop and SmartDevice DLL, otherwise it doesn't run properly on
> the
> > smartdevice (at least that's been my experience).
> >
> > Dan
> >
> >
> > "lukasz" <bbla32@op.pl> wrote in message
> > news:On6cQpZmEHA.1376@TK2MSFTNGP12.phx.gbl...
> > > 1. Add your own directive in the projects' properties (add
"SMARTDEVICE"
> > > after "DEBUG, TRACE"). Then in code use:
> > >
> > > #if SMARTDEVICE
> > > ...
> > > #else
> > > ...
> > > #endif
> > >
> > >
> > > 2. Make two solutions: YourAppDesktop & YourAppDevice. To one solution
> > > (arbitrary) add new library project YourAppLibrary which will contain
> the
> > > shared files; it'll be compiled to a DLL. The to the other solution
add
> an
> > > EXISTING project: YourAppLibrary. Now, assuming you have added main
> > projects
> > > to both solutions (say, YourAppProjectDesktop & YourAppProjectDevice),
> > > choose the projects' nodes, then subnode References, and add new
> > reference.
> > > Choose 3rd tab, choose YourAppLibrary.
> > >
> > > Summarizing:
> > > YourAppDesktop solution
> > > YourAppLibrary (new)
> > > YourAppProjectDesktop
> > > reference to YourAppLibrary (not DLL, but project)
> > > YourAppDevice solution
> > > YourAppLibrary (existing, from Desktop's solution)
> > > YourAppProjectDevice
> > > reference to YourAppLibrary (not DLL, but project)
> > >
> > > The disadvantage is both solutions now need a DLL, but I don't know of
> an
> > > other method to share sources.
> > >
> > >
> > > U¿ytkownik "Dan" <dan@dontspamme.com> napisa³ w wiadomo¶ci
> > > news:#lra0wYmEHA.3428@TK2MSFTNGP14.phx.gbl...
> > > > I'd like to have a set of more-or-less common code which I want to
use
> > for
> > > > both desktop and smart device projects. I have two questions:
> > > >
> > > > 1. How can I set up conditional compile directives for those parts
of
> > the
> > > > code which are different on desktop and smart device projects
> > > > 2. How can I actually share the same .cs source code files between
the
> > two
> > > > projects. If I try to open a smart device project and add the files
> > which
> > > > are in the desktop project's directory, those files get copied into
> the
> > > > smart device project's directory. Thus, changes which I make in one
> > > project
> > > > don't get applied to the other one. On the other hand, if I define
> the
> > > > smart device project in the same directory as the desktop project, I
> > > > overwrite files in the desktop project directory (in particular
> > > > AssemblyInfo.cs-- I can rename the output files to distinguish
between
> > the
> > > > assemblies for the two projects).
> > > >
> > > > Thanks...
> > > >
> > > > Dan
> > > >
> > > >
> > >
> > >
> >
> >
>
>