Unfortunately, building mg-desktop from source is a complex multi-step affair like its MapGuide Server/Web counterpart, that requires a full checkout of the entire MapGuide source tree:
- We need to build FDO and/or setup the binary SDK in the correct path under MgDev\Oem
- We need to build the MapGuide Oem stack
- We need to build the MapGuide and mg-desktop shared C++ components and SWIG bindings
- Finally, we need to build the mg-desktop .net components
Assuming you just want to hack around with the mg-desktop .net viewer component source, there is a way to skip steps 1-3 and avoid the full checkout. This post will show you how.
We'll demonstrate using the Express Edition of Visual Studio 2012 for Windows Desktop in conjunction with the .net 4.0 build of mg-desktop. For the .net 2.0 build, you will need Visual Studio 2008 instead.
Firstly, grab the latest mg-desktop binaries.
Then, do a subversion checkout of the MgDev\Desktop directory under the 2.4 branch (as this is the source branch used to produce the latest mg-desktop binaries). The SVN checkout URL for this is:
Note that checking out this directory will only let you build the viewer source (the objective of this post). You cannot build the full mg-desktop set of binaries from this directory. To do that would require checking out its parent (MgDev) instead and doing the full 4 builds steps, which will take some time.
In your fresh SVN checkout, create a bin directory
Inside this bin directory, create a release directory (for 32-bit). For 64-bit, use release64
In the latest binaries zip file, extract the files under the Desktop directory to your release or release64 directory, which should now look like this after extraction
Back in the bin directory, create an Assemblies directory and move the following files from release/release64 into this directory:
In addition, copy the related XML files as well if you want intellisense on these assemblies
You have now replicated the binary output that steps 1-3 would've produced on a full SVN checkout, so now we can go straight to step 4 and open the mg-desktop .net solution file in Visual Studio:
- MgDesktopDotNet.sln if you're using the .net 2.0 build and VS 2008
- MgDesktopDotNet_VS2010.sln if you're using the .net 4.0 build and VS 2010 or VS 2012
Make sure the platform configuration matches the bitness of your mg-desktop binaries, otherwise you'll get BadImageFormatException trying to debug any of the executable projects.
Once that is set, you can now build the entire .net solution. Updated viewer component assemblies will be under bin\release for 32-bit and bin\release64 for 64-bit
Now the viewer is ready to be hacked around. The projects you probably be most interested in are:
- MapViewer - Contains the source for the mg-desktop viewer component
- MapViewer.Desktop - Contains the source for the mg-desktop implementation of MgMapViewerProvider
- MapViewerTest - A test WinForms application that embeds the map viewer component.
- MgAppLayout - The App Layout Engine front-end executable
For the VS2010 solution, these projects are suffixed with .Net40