This project is read-only.

Visual C++ 2003 and DotSpatial

Jan 4, 2011 at 3:11 PM

I'd like to display a map in a dialog using Visual C++ 2003.  Would it be possible to use DotSpatial for this?

Jan 4, 2011 at 4:24 PM

DotSpatial has releases for .Net versions 3.5 and 4.0 only.  I think Visual C++ 2003 works with .Net 2.0, and you will not be able to reference the libraries directly with that version of visual studio.  If you have visual studio 2010 express, you may be able to use the source code and change some content to work with the 2.0 target framework, but it was not designed with that goal in mind so there are a large number of instances that reference content from the 3.0 framework or greater, like linq.   This is usually not a problem since the express versions of visual studio are free, most people just switch to the latest version each time one comes out.  Since the MapWindow 4.x library uses a COM map library, you should be able to display a map using the MapWinGIS.ocx map in visual studio 2003.   DotSpatial was deliberately created to try to become a completely .Net enterprise and seeks not to rely on COM registration or "dll hell", but it was decided that we would not try to support all versions of the .Net Framework since this library was originally created at a time when 2005 was available, and was upgraded to 2008 and most recently to 2010.  The transition to the 4.0 framework was recent enough that no long term changes have been added that rely on the 4.0 framework specifically, so you can still recompile for framework 3.5.  I currently use MSBuild to create the 3.5 release versions for the download page.



Jan 6, 2011 at 4:24 PM
Edited Jan 6, 2011 at 4:32 PM

Update:  If you use VS2010, you can build the solution, but make it COM visible.  Follow the instructions here:

And you can create a variant of any of the DotSpatial Dll libraries that will work in COM.  This will allow you to use DotSpatial content from Microsoft Access or other COM  only environments.  This includes VS 2003 and earlier versions that cannot reference directly later versions of .Net.


P.S. Make sure you compile to x86 on x64 machines or it won't work.

Jan 6, 2011 at 8:27 PM

shade1974, Why don't we set ComVisibility(true) for all of the components?

Jan 6, 2011 at 9:02 PM

Because doing so forces registration, and creates conflicts when making changes to the COM visible methods, or when trying to simultaneously support two slightly different versions etc.  For modern programmers, anything we can do to avoid anything related to COM was part of our mandate for creating DotSpatial in the first place.  We wrote the .Net apps with the goal in mind of getting out of the dll hell, so while I think it's fine to allow those with the source code to build their own COM process, I don't think we should have the code COM visible by default.


Jan 7, 2011 at 11:24 PM

Also, if you set COM Visible to true, and you suffer from windows security settings, you will need to run Visual Studio as Administrator in order to build your project.  This may be related to User Account Control or whatever, but seems to be set up that way on most work computers.