Using CSharp Mapscript with VS2005 and .NET 2.0

Jim Bartol jbartol at MMM.COM
Mon Aug 28 17:08:17 EDT 2006


I have been experimenting with the latest version of MS4W V2.1 via a web
browser, and learning some of the basics about how MapServer works.  I am
now trying to use CSharp Mapscript to access MapServer directly from a
WinForms application.  I understand that the MS4W binaries have been
compiled for .NET 1.1, and that there are some issues with running them
against .NET 2.0 as described in
http://mapserver.gis.umn.edu/docs/howto/mapscriptcscompile.  My
*.exe.manifest file shows a reference to the CRT as described in section
3.1 of this website, but I still get a runtime error "The type initializer
for 'mapscriptPINVOKE' threw an exception" when creating an instance of a
MapServer object (e.g., mapObj map = new MapObj("mapfile.map").  Both
mapscript.dll and mapscript_csharp.dll are in my bin/debug directory.

I came across a previous post from David Lother who may have worked through
a similar problem.  Any suggestions as to what I might be missing in
regards to building a WinForms app with CSharp Mapscript?  Could there be
something I've overlooked regarding manifest files?  Can I use MS4W V2.1
with .NET 2.0, or should I rebuild the binaries using the VS2005 compiler?

Thanks for any help you can provide,



More information about the mapserver-users mailing list