Wednesday, 5 September 2012

mg-desktop: The NuGet edition

So with the latest release of mg-desktop, I was supposed to have a NuGet version ready as well.

For those who don't know what NuGet is, it is a Visual Studio 2010 extension which basically functions like an apt-get for libraries and tools in Visual Studio. A command-line version of NuGet also exists.

It turns out nuget.org didn't like my original mg-desktop package which was 38MB in total, so I had to get creative in slicing and dicing this package down to sub-packages of reasonable size, without compromising the utility of the individual sub-packages. The resulting mg-desktop package is now a set of following sub-packages:

  • mapguide-api-base
  • mg-desktop
  • mg-desktop Viewer
mapguide-api-base^ contains the core MapGuide API components
  • Foundation
  • Geometry
  • PlatformBase
  • A subset of the CS-Map coordinate system dictionaries
This package is sufficient enough to build applications using only the Coordinate System and Geometry APIs of MapGuide, though you will need to set up the coordinate system dictionary path manually as there is no Platform.ini (which defines this path) to initialize if you are solely using this package. So you will need to have the MENTOR_DICTIONARY_PATH environment variable defined, or point the path manually like so.

mg-desktop* contains the mg-desktop specific components. It has a dependency on mapguide-api-base and will download/install it too if required. This does not have the viewer component, which is a separate package.

mg-desktop Viewer is the viewer component for mg-desktop. It has a dependency on mg-desktop and will download/install it too if required. It will also auto-reference System.Windows.Forms and System.Drawing in your project if needed.

So depending on your particular needs, you select the appropriate packages with NuGet, which will download the required packages/dependencies and automagically set up everything for you (references, post-build steps, etc).

One important thing to note about this package is that it the 32-bit build of mg-desktop for .net Framework 4.0. You cannot consume this package for .net projects whose framework version is < 4.0 and in order for your application to run on 64-bit systems, the root executable project must be explicitly set to x86 and not AnyCPU. Stick with the zip distribution if you are using .net Framework 3.5 or older.

The other important thing to note is that this is my first NuGet package upload. My NuGet n00biness is on full display :-) If there are any problems with any of the packages, I'd appreciate any pointers or patches sent my way to fix these problems.

Download
^ I'll probably split off the CS-Map dictionaries into a separate package in a future version. Also if I ever decide to NuGet-ify the official assemblies for MapGuide Open Source 2.4, it will definitely have a dependency on this package.
* Likewise, I'll probably split off FDO into its own package

No comments: