VS won't allow sharing CF and desktop projects with each others'solutions

R

Rik Hemsley

I've seen (thanks to google groups) that it's possible to share code
between projects which target different .NET frameworks, by linking code
files.

I'd like to share an entire class library project, which is framework-
independent, between two solutions, one targetting the CF and one the
desktop.

My problem is that VS.NET 2003 won't allow me to share projects.

If I load up my desktop-targetting solution and try to add a class
library project which I specified (at creation) would target the CF, VS
says 'The operation could not be completed'.

If I load up my CF-targetting solution and try to add a class library
project which I specified would target the desktop framework, VS says
that the VB.NET compiler could not be created and that all projects in a
VB solution must target the same platform.

If it's not possible to share projects in this way (how are we supposed
to write cross-platform applications?) then perhaps it's possible to
share DLLs instead.

I tried adding a DLL, created by a desktop project, as a reference of a
CF project. VS then warned me that it may not be compatible, then gives
two errors looking like this:

Error: The dependency 'mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=969db8053d3322ac' in project 'LQGUI' cannot be copied to
the run directory because it would conflict with dependency 'mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

And one like this:

The dependency 'System.Design' could not be found.

Does the first error just mean that VS can't cope with me having two
..NET frameworks with the same version (but different targets)? If so, is
that even fixable?

Is my only option to create new projects and link all source files across?

Cheers,
Rik
 
P

Peter Foot

You can add a reference to a Compact Framework compiled dll to a desktop
project, but not the reverse. As you've already discovered you can't share
the project in both solutions, but you can reference the device dll in your
desktop project. The only caveats to this are that your device dll must not
reference any device specific functionality such as SqlCe, System.Net.IrDa,
Microsoft.WindowsCE.Forms etc.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
 
R

Rik Hemsley

Peter said:
You can add a reference to a Compact Framework compiled dll to a desktop
project, but not the reverse. As you've already discovered you can't share
the project in both solutions, but you can reference the device dll in your
desktop project. The only caveats to this are that your device dll must not
reference any device specific functionality such as SqlCe, System.Net.IrDa,
Microsoft.WindowsCE.Forms etc.

I ended up creating new projects in the CF solution, and linking files
over from the desktop version.

This was ok until I realised that my ADO stuff was broken. It seems that
some things are missing in the CF (DataSet.Merge?), so my
DataSet-derived classes wouldn't compile and there were problems with
the .xsd files, which were something to do with the Component containing
my OleDbConnection and DataAdapters.

I couldn't get into the designer for my component, which seems to be
because anything vaguely GUI design related (uh, this isn't, really) is
forbidden.

Now I've realised that not only would I have to stick lots of #ifdefs in
to switch to SQL Server storage (why isn't it possible to use an
Access database on the CF?), I'd have to rewrite all the stuff that uses
DataSets, which is basically half my app's code.

I give up - I'm sticking with the XML file(s) storage code I've already
written for the CF version of my app, and using database storage on the
desktop only.

Cheers,
Rik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top