UWP 应用程序和 SqlServerSpatial140.dll 个问题,共 microsoft.sqlserver.types 个问题

UWP app and SqlServerSpatial140.dll of microsoft.sqlserver.types issue

我有一个 UWP 应用程序,它通过 Nuget 引用了 Microsoft.Sqlserver.Types,里面有 代码

var coords = new List<BasicGeoposition>();
var point = SqlGeography.Point(wDitsrLoaderLat, wDitsrLoaderLng, 4326);
var poly = point.BufferWithTolerance(radiusInMeter, 0.01, true);
for (int i = 1; i <= poly.STNumPoints(); i++)
{
   var currentPoint = poly.STPointN(i);
   coords.Add(new BasicGeoposition() { Latitude = currentPoint.Lat.Value, Longitude = currentPoint.Long.Value });
}

在开发环境下它工作正常但在客户端计算机 MS 上运行 UWP 应用程序后 Windows 10 出现此错误

System.DllNotFoundException: Unable to load DLL 'SqlServerSpatial140.dll' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E) at Microsoft.SqlServer.Types.GLNativeMethods.GeodeticAngleExtent(GeoMarshalData g, Double eccentricity, Double& result) at Microsoft.SqlServer.Types.GLNativeMethods.GeodeticAngleExtent(GeoData g, Double eccentricity) at Microsoft.SqlServer.Types.SqlGeography.EnvelopeAngle() at Microsoft.SqlServer.Types.SqlGeography.BufferWithTolerance(Double distance, Double tolerance, Boolean relative)

我已验证 microsoft.sqlserver.types.dll 存在于安装文件夹下

请帮我解决这个问题。 谢谢!

这是答案

我们必须包含来自

的两个 DLL
.nuget\packages\microsoft.sqlserver.types.0.1016.290\nativeBinaries\x64\SqlServerSpatial140.dll

.nuget\packages\microsoft.sqlserver.types.0.1016.290\nativeBinaries\x64\msvcr120.dll

到 UWP 应用项目并将其标记为“始终复制”。

就是这样! )))