[gdal-dev] using OGR/OSR from C# - where to put the dependent DLLs?

Tamas Szekeres szekerest at gmail.com
Tue Dec 11 14:48:48 EST 2007


Mark,

Adding C:\Program Files\FWTools2.0.0\bin\ to the system PATH should be
enough. However you should make sure there's no preceding folder int
the PATH containing incorrect version of these dll-s. Moreover in
FWTools you should remove the _fw suffix in some of the file names.

I would suggest using SysInternals filemon to monitor which files
couldn't be loaded by your application.

Best regards,

Tamas



2007/12/11, Mark Cheyne <cheynm at yahoo.com>:
> Hello - I'm sure this is a common question, but I
> haven't found a definitive treatment on the OGR
> website or in the GDAL mailing list archives.
>
> I'm working on a C# app on Windows that does
> coordinate transformations using the
> OSGeo.OSR.SpatialReference class. My app references
> osr_csharp.dll.
>
> Bottom line, what do I need to do so that the DLLs
> that osr_csharp.dll is dependent on are available at
> run-time?
>
> Only if I copy all 61 DLLs found in C:\Program
> Files\FWTools2.0.0\bin to my app's directory does my
> app work. However, for a variety of reasons,
> especially unit testing, I'd prefer to find an
> alternative, if one exists.
>
> I've seen
> http://trac.osgeo.org/gdal/wiki/GdalOgrCsharpUsage and
> http://trac.osgeo.org/gdal/wiki/GdalOgrInCsharp which
> say that adding C:\Program Files\FWTools2.0.0\bin\ to
> my PATH env var is enough - nope.
>
> I've seen somewhere that I could copy all 61 DLLs
> found in C:\Program Files\FWTools2.0.0\bin to my
> System32 directory - that doesn't work either.
>
> If the dependent DLLs are not found, at runtime I get
> the following exception when I call the
> SpatialReference constructor: "The type initializer
> for 'OSGeo.OSR.OsrPINVOKE' threw an exception.". The
> innermost exception is what you'd expect -
> "System.DllNotFoundException: Unable to load DLL
> 'osr_wrap': The operating system cannot run."
>
> Thank you, Mark
>
> Mark Cheyne
> (608) 332-2235 (cell)
>
>
>       ____________________________________________________________________________________
> Never miss a thing.  Make Yahoo your home page.
> http://www.yahoo.com/r/hs
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


More information about the gdal-dev mailing list