Csharp/MapScript

Tamas Szekeres szekeres.tamas at FREEMAIL.HU
Thu Nov 17 15:00:34 EST 2005


I recommend to compile mapserver and the related libraries for yourself
before using them with ASP.NET. It is highly suggested to use the same
compiler version for theese packages (eg VS 2003).

The Win32 compilation instructions can be found at:

http://mapserver.gis.umn.edu/doc46/win32_compile-howto.html

to compile use Visual Studio .NET Command Prompt and nmake.

To compile mapscript:

1. download the latest SWIGWin package which contains the Win32 binary
SWIG.EXE

2. edit nmake.opt for referring to the SWIG location

3. In Visual Studio .NET Command Prompt cd to mapscript/csharp

4. nmake -f makefile.vc

To test the compilation

5. Create an empty ASP.NET C# project

6. Add reference to the previously compiled mapscript_csharp.dll

6. Use the following code to test the map creation

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
        using (mapObj map = new mapObj(@"C:\Maps\MapFiles\mymap.map"))
 {
    using(imageObj image = map.draw())
    {
  byte[] img = image.getBytes();
  Response.BinaryWrite(img);
    }
 }
}

7. Before testing the project make sure that all of the dlls (depending on
the mapserver compiler options, eg: bgd.dll, gdal13.dll, libcurl.dll,
libmap.dll, mapscript.dll, mapscript_csharp.dll, proj.dll) reside in the
correct location. I recommend to place the dll-s to the same directory as
your target file.



Best Regards,

Tamas Szekeres


On Tue, 15 Nov 2005 13:08:06 -0600, Suman G. Pradhan
<sgp_dgtek at HOTMAIL.COM> wrote:

>Dear all
>Please some one help me finding Csharp/MapScript.
>Why there is no resources related with MapServer and .Net ?



More information about the mapserver-users mailing list