Targeting the Compact Framework with SharpDevelop

30Aug03

I’m in a coding state of mind lately, so I decided to dust off an unfinished Compact Framework project. This presented some problems, of course. My Beta installation of VS.NET 2003 expired in June. I have a stand-alone version of VB.NET 2002, not VS.NET 2002, so I’ve been left out in the cold when it comes to .NET CF updates. My fault for making a purchasing decision based on an unreleased feature that hadn’t entered Beta yet. My bad.

There are published instructions for targeting the CF without Visual Studio .NET 2003, little different than what I had attempted when trying to compile XML-RPC.NET against the CF back when the Beta was still an add-in for the 2002 product line. The technique works and has a neat side benefit: the resulting executable will run under the regular .NET Framework. Getting the device or device emulator out of the Compile / Run / Debug process is a major time saver…

But compiling from the command-line falls a bit short of my hopes and dreams. I don’t need all of what Visual Studio has to offer, but I do like pressing one key or clicking one menu item to compile, clicking on my compile errors and being taken to the offending line of code, etc. Enter SharpDevelop. I couldn’t find any instructions for making #develop target the .NET CF, only pointers back to jpzr’s guide, but I managed to find a solution:

  • Create a new VB.NET Project.
  • Add existing .vb source files.
  • Remove all of the default references from the Project.
  • Add .NET CF references using the .NET Assembly Browser, see jpzr’s guide for the correct files.
  • Add explicit Imports statements for everything.

Viola, instant .NET CF executable from a comfortable IDE with Visual Studio .NET 2003 nowhere in sight. On the Imports bit, apparently the VS.NET compiler would see code like Inherits System.Windows.Forms.Form and auto-magically make the import happen. Or something. I’m a solutions weenie, not a compiler weenie. I don’t really know, and I don’t really care to know.

I had some trouble making these steps work with a C# project, the compiler would spew out a bunch of warnings like this:

'blah‘ is defined in multiple places; using definition from ‘Desktop Framework\blah.dll’

Referencing mscorlib.dll, as shown in jpzr’s command-line examples, produced a working .NET CF executable. The warnings remain but point to the .NET CF files instead. VB.NET projects don’t seem to need the reference and there are no warnings. I’m guessing that it’s a difference in compiler behavior, or something. Did I mention that I’m a solutions weenie, not a compiler weenie?

I think that I solved a good one tonight.

4 Responses to “Targeting the Compact Framework with SharpDevelop”


  1. 1 Ara Posted December 15th, 2003 - 6:48 am

    “Remove all of the default references from the Project”

    How??

    Nice work.

  2. 2 megiddus Posted March 20th, 2004 - 8:04 am

    Thanks for this tip!
    My project worked once without the references, but somehow i wasn’t able to rebuild it - very strange…

    Now it works!

  3. 3 Bryce Posted April 10th, 2004 - 9:43 pm

    This technique was tested with #develop 0.96. It doesn’t seem to work with 0.99, I’m still looking for a solution.

    http://www.ntwizards.net/2004/04/10/resurection

  4. 4 michael Posted January 8th, 2005 - 6:35 pm

    I have posted a guide for developing compact framework applications with sharpdevelop at the sharp develop wiki:
    http://wiki.sharpdevelop.net/default.aspx/SharpDevelop.PocketPCs

Comments are currently closed.

Valid XHTML 1.0 Transitional

Advertisements

Plugging my Employer

 


Plugging my Employer

Advertisements

Flickr Photos