在 ASP.NET Core 3.0 中找不到 'GeoAPI' 和 'IPoint'

'GeoAPI' and 'IPoint' could not be found in ASP.NET Core 3.0

将项目从 ASP.NET Core 2.2 更新到 ASP.NET Core 3.0 时开始出现错误:

The type or namespace name 'GeoAPI' could not be found (are you missing a using directive or an assembly reference?).  
The type or namespace name 'IPoint' could not be found (are you missing a using directive or an assembly reference?

在我的项目中,我有以下内容:

<ItemGroup>
  <FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
  <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.*" />
  <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.*" />
  <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="3.*" />
</ItemGroup>    

我一直在尝试寻找 GEO 对象是否有一些变化,但找不到任何东西。

有人知道如何解决这个问题吗?

您缺少 GeoAPI.Core nuget 包。请安装这个。错误应该消失。

PM > Install-Package GeoAPI.Core -Version 1.7.5

只是想补充一些信息,我在更新到 .net core 3.0 时发现的一些事情:

不需要安装GeoAPI.Core,您可以通过一些小的重构使其工作。这些是我升级的步骤:

  1. 升级到 .NET Core 3.0 和 Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite 到 3.0.0

  2. 删除所有使用 GeoAPI.Geometries

  3. 将所有出现的几何接口(IGeometry、IPoint、ILineString 等)切换到它们对应的实现(Geometry、Point、LineString)。这也适用于数据库模型中的属性(有效)。

另见:Upgrading to 2.0 from 1.x

注意: 目前 (2019-11-22) 有一个错误阻止您将大型几何图形保存到 sql 服务器。这里有一个悬而未决的问题: https://github.com/aspnet/EntityFrameworkCore/issues/18813

注2: 上述错误已在 .NET 5 中修复