无法加载 DLL“ogr_wrap”或其依赖项之一

问题描述 投票:0回答:1

在我的 C# 项目中,我添加了 GDAL 和 GDAL.Native nuget 包。尝试时

Geometry h = Ogr.CreateGeometryFromJson(geometry);

我明白了

The type initializer for 'OSGeo.OGR.OgrPINVOKE' threw an exception
Unable to load DLL 'ogr_wrap' or one of its dependencies

ogr_wrap 在那里,不是与 ogr_csharp.dll 等所有其他 dll 一起,而是在 gdal/x64 子目录中

其他一些 GDAL 方法(如 GetGeoTransform、GetRasterBand 等)可以正常工作。

我错过了什么吗?

GDAL 是 3.7.2,VS 是 17.8.2,.NET 8.0(7.0 中的行为相同)。

gdal
1个回答
0
投票

在使用 Ogr 之前,请确保您已在代码中包含以下内容:

GdalConfiguration.ConfigureGdal();
GdalConfiguration.ConfigureOgr();
© www.soinside.com 2019 - 2024. All rights reserved.