[mapguide-users] Access from .Net winforms or console?
Andy Morsell
amorsell at spatialgis.com
Fri May 19 19:14:24 EDT 2006
Jason,
I was able to build and run without any problems so I'm with Traian, you
probably need to add C:\Program
Files\MapGuideOpenSource\WebServerExtensions\www\mapviewernet\bin to your
path.
Andy
-----Original Message-----
From: Jason Birch [mailto:Jason.Birch at nanaimo.ca]
Sent: Friday, May 19, 2006 3:23 PM
To: users at mapguide.osgeo.org
Subject: [mapguide-users] Access from .Net winforms or console?
I'm playing around with using MapGuide within Visual Studio/C# and am
getting stuck pretty early.
I have added a reference to MapGuideDotNetAPI (the dll is in the bin
directory) and imported the OSGeo.MapGuide namespace. Intellisense seems to
be working correctly, and the app seems to compile OK. However, on the first
call to a MapGuide method, I get an exception.
"The type initializer for 'MapGuideApiPINVOKE' threw an exception."
Anyone have any ideas? I'm a bit of a newbie in this environemnt, so feel
free to whack me on the side of the head :)
Jason
Oh, here's the code:
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide;
namespace cli_makepackage
{
class Program
{
static void Main(string[] args)
{
try
{
MapGuideApi.MgInitializeWebTier("./webconfig.ini");
MapGuideApi.InitializeSockets();
MgUserInformation userInfo = new
MgUserInformation("Administrator", "admin");
MgSite mgSite = new MgSite();
mgSite.Open(userInfo);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
For additional commands, e-mail: users-help at mapguide.osgeo.org
More information about the Mapguide-users
mailing list