<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.6617.95">
<TITLE>[mapguide-users] Access from .Net winforms or console?</TITLE>
</HEAD>
<BODY dir=ltr>
<DIV> </DIV>
<DIV>Are all the dlls (like MgCommon.dll) that the .Net API depends on
somewhere in the path also?</DIV>
<DIV> </DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV><FONT size=2>-----Original Message----- <BR><B>From:</B> Jason Birch
[mailto:Jason.Birch@nanaimo.ca] <BR><B>Sent:</B> Fri 5/19/2006 6:22 PM
<BR><B>To:</B> users@mapguide.osgeo.org <BR><B>Cc:</B> <BR><B>Subject:</B>
[mapguide-users] Access from .Net winforms or
console?<BR><BR></FONT></DIV><BR>
<P><FONT size=2>I'm playing around with using MapGuide within Visual Studio/C#
and am<BR>getting stuck pretty early.<BR><BR>I have added a reference to
MapGuideDotNetAPI (the dll is in the bin<BR>directory) and imported the
OSGeo.MapGuide namespace. Intellisense<BR>seems to be working correctly,
and the app seems to compile OK. However,<BR>on the first call to a MapGuide
method, I get an exception.<BR><BR>"The type initializer for
'MapGuideApiPINVOKE' threw an exception."<BR><BR>Anyone have any ideas?
I'm a bit of a newbie in this environemnt, so<BR>feel free to whack me on the
side of the head :)<BR><BR>Jason<BR><BR>Oh, here's the code:<BR><BR>using
System;<BR>using System.IO;<BR>using System.Collections.Generic;<BR>using
System.Text;<BR>using OSGeo.MapGuide;<BR><BR><BR>namespace
cli_makepackage<BR>{<BR> class Program<BR>
{<BR> <BR>
static void Main(string[] args)<BR>
{<BR>
try<BR>
{<BR><BR>
MapGuideApi.MgInitializeWebTier("./webconfig.ini");<BR>
MapGuideApi.InitializeSockets();<BR>
MgUserInformation userInfo = new<BR>MgUserInformation("Administrator",
"admin");<BR>
MgSite mgSite = new
MgSite();<BR>
mgSite.Open(userInfo);<BR><BR>
}<BR> catch
(Exception
ex)<BR>
{<BR>
Console.WriteLine(ex.Message);<BR>
}<BR><BR><BR> <BR>
}<BR>
}<BR>}<BR><BR><BR>---------------------------------------------------------------------<BR>To
unsubscribe, e-mail: users-unsubscribe@mapguide.osgeo.org<BR>For additional
commands, e-mail:
users-help@mapguide.osgeo.org<BR><BR></FONT></P></BLOCKQUOTE>
</BODY>
</HTML>