I try to write a makro for RegioGraph (regiograph.de). I have almost no knowledge of .NET. There is a help file from RegioGraph describing the API itself, but there is very limited information on how to use it. The only useful reference I found is this sample in C#: http://www.cgo.se/wordpress/2010/10/14/regiograph-api/.
updated 2013-12-11 after following advices from comments:
I found out the RegioGraph assembly is .NET 2.0, so I installed corresponding IronPython-2.6.2-Net20.msi: http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=ironpython&DownloadId=159513&FileTime=129321579152370000&Build=20841
I want to get an Application object:
IronPython 2.6.2 (2.6.10920.0) on .NET 2.0.50727.7905
Type "help", "copyright", "credits" or "license" for more information.
>>> import clr
>>> clr.AddReferenceToFileAndPath('C:/Program Files/GfK GeoMarketing/RegioGraph Planung 11/GfK.GeoMarketing.Api.dll')
>>> import GfK.GeoMarketing.Api
>>> app = GfK.GeoMarketing.Api.RegioApplication()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 2] Die Datei oder Assembly "GfK.GeoMarketing.Api, Version=11.0.0.96, Culture=neutral, PublicKeyToken=49e059cfaef07841" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
Examination with Fusion protocol shows that the assembly is searched only in the global assembly cache (GAC) and in the IronPython program folder. So a workaround is to copy GfK*.dll into C:/Program Files/IronPython 2.6/.
When I installed Visual Studio Express 2013 Desktop I got this short C# program to work:
using GfK.GeoMarketing.Api;
class RGStart
{
static void Main()
{
RegioApplication application = new RegioApplication();
}
}
I had to follow these steps (trying to translate german terms):
- new project, installed/templates/Visual C#/Windows/console application, name: RGStart
- project, RGStart properties, application, target framework .NET 2.0
- project, RGStart properties, make/build, target platform x86
- delete invalid references (marked in project map explorer)
- project, add reference, browse, C:\Program Files\GfK GeoMarketing\RegioGraph Planung 11
- GfK.GeoMarketing.Api.dll
- GfK.GeoMarketing.Gui.dll
- GfK.GeoMarketing.ManagedBackend.dll
- replace C# code (Program.cs)
- F5, no more error messages, the application object enables access to RegioGraph
clr.AddReferenceon all of theGfK.GeoMarketing.*assemblies before doing anything else - I'm guessing it's having trouble loading one of them but the exception isn't clear about why. Otherwise you'll need to look into enabling Fusion logging and usingfuslogvw.exeto figure out what the loading issue is. - Jeff Hardy