Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Occasional Contributor
Posts: 14
Registered: ‎01-25-2017

Define path for dependent dll's

Hello all,

 

i'm quite new to Geomedia programming, maybe my question is trivial, but i couldn't find an answer:

 

I have a quite large C# WPF-application and haveto integrate it with Geomedia. I've managed to create acustom command, register taht command and have it deployed into Geomedia. As a result, there's now a new tab with my new command and when i click it, my programcode starts to run.

 

Now i have one problem:

My C#-code results in approx. 50 separate dll's which i allput into the path which i also specfiied in the registration command.

But whenever code goes to one of the dependent dll's, that code is not found. It seems Geomedia does not search the path for dependent dll's. When i copy all my dl's into the program-path where geomedia.exe resists, the application runs, but that's of course not a solutio.

 

So here my question:

Can i specify the path, where cutom command have put additional Dll's which have to dynamically loaded?

 

Thanks in advance,

Andreas

Technical Evangelist
Posts: 566
Registered: ‎09-11-2015

Re: Define path for dependent dll's

Hello Andreas,

 

this is rather a general question about Windows OS and application, and you can find the answer on the internet. For example you can find some information here or here. However, you have basically two options:

  1. add the path with your dlls to the PATH environment variable (not recommended by MicroSoft)
  2. or add the path to your dlls to the Path value of this registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\GeoMedia.exe (recommended) - but be careful not to delete the actual value, just add semicolon ";" and your path

 

Pavel

Occasional Contributor
Posts: 14
Registered: ‎01-25-2017

Re: Define path for dependent dll's

Hello Pavel,

 

thanks for your reply.

 

I know how to generally handle dll's and search-paths. But as a command is some kind of "Add-In" into geomedia i had hoped that there is also some kind of configuration possible for these commands. I've developed add-on's for CAD-systems which is quite similar to commands in Geomedia. There you can define a specific directory where the CAD-system should search for addon-specific dll's. This makes it possible to easily "configure" client-pc's without having to make full installation packages, which will be needed if you want to modify the registry and add the dll's to the Geomedia.exe settings.

 

Regards,

Andreas

Technical Evangelist
Posts: 566
Registered: ‎09-11-2015

Re: Define path for dependent dll's

Hello Andreas,

 

I am not aware of any such mechanism within GeoMedia. But if I look for example at GeoMedia Grid, which has lots of dlls in separate folder, the only path to this folder is in the resgistry under "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\GeoMedia Grid". So perhaps if all the dlls are .NET dlls, it might be sufficient to create similar entry in the registry. But I haven't tested that.

 

Pavel

Staff
Posts: 298
Registered: ‎11-05-2015

Re: Define path for dependent dll's

If I recall correctly, the .NET Framework assembly probing logic looks in globally defined Assemby Folders and in the AppDomain's BaseDirectory and possibly any PrivatePaths added. The latter need to be sub-folders of the entry assembly, though, due to security reasons.

 

Pavel's answer about adding a registry entry is entirely correct, but if you don't want to manipulate the registry for your command, you might have some success by adding a bit of runtime logic to your extension as per: http://stackoverflow.com/questions/1373100/how-to-add-folder-to-assembly-search-path-at-runtime-in-n...