[mapguide-users] Access from .Net winforms or console?

Traian Stanev traian.stanev at autodesk.com
Fri May 19 19:03:57 EDT 2006


 
Are all the dlls (like MgCommon.dll) that the .Net API depends on somewhere in the path also?
 

	-----Original Message----- 
	From: Jason Birch [mailto:Jason.Birch at nanaimo.ca] 
	Sent: Fri 5/19/2006 6:22 PM 
	To: users at mapguide.osgeo.org 
	Cc: 
	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
	
	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20060519/03ede26a/attachment.html


More information about the Mapguide-users mailing list