[gdal-dev] How to use Gdal c# bindings with .NET Core
Gigas002
gigas002 at yandex.ru
Sat Dec 15 06:49:57 PST 2018
Hello everyone. I'm trying to use c# bindings with .NET Core 2.0 on Visual
Studio 2017.
Tried to use multiple nuget packages:
1. https://www.nuget.org/packages/GDAL/ +
https://www.nuget.org/packages/GDAL.Native/
I used these packages for my .NET Framework project and it worked fine, but
it doesn't compile on .NET Core. The namespace OSGeo just couldn't been seen
and " 'GDAL.Native 2.3.2' package was restored using
'.NETFramework,Version=v4.6.1' " warning is thrown by VS.
2. https://www.nuget.org/packages/GDAL.NET/
Throws the same warning about .NET Framework 4.6.1 and requires to write
GdalConfiguration class, because Gdal.AllRegister() method wouldn't work.
3. https://www.nuget.org/packages/Gdal.Core/2.3.0-beta-023 +
https://www.nuget.org/packages/Gdal.Core.WindowsRuntime/2.3.0-beta-023 +
https://www.nuget.org/packages/Gdal.Core.LinuxRuntime/2.3.0-beta-023
Doesn't throw any warnings/errors, compiles fine and Gdal.AllRegister()
method works OK.
So, the built application works with the 3rd set of packages. But after
building the app, I use VS's "publish" to create standalone win-x64 and
linux-x64 app. And this version doesn't work at all.
At first it throws exception, because it couldn't find gdal_wrap.dll, if
I'll copy all needed dll's and the content from gdal-data directory from
pre-built gdal binaries (taken from here for example:
http://www.gisinternals.com/query.html?content=filelist&file=release-1911-x64-gdal-mapserver.zip)
to the directory with published .exe file, it'll throw another error:
System.EntryPointNotFoundException: Unable to find an entry point named
'CSharp_OSGeofGDAL_AllRegister___' in DLL 'gdal_wrap'.
So, probably I'm doing something wrong? Is there a complete guide how to use
gdal bindings with .NET Core to built standalone application? Thanls in
advance for your reply!
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
More information about the gdal-dev
mailing list