Mig*_*ura 1 c# asp.net-core-3.0 .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?
Run Code Online (Sandbox Code Playgroud)
在我的项目中,我有以下内容:
<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>
Run Code Online (Sandbox Code Playgroud)
我一直在尝试查找 GEO 对象中是否有一些更改,但找不到任何内容。
有谁知道如何解决这个问题?
只是想为此添加信息,我在更新到 .net core 3.0 时发现了一些信息:
不需要安装 GeoAPI.Core,您可以通过一些小的重构使其工作。这些是我升级的步骤:
升级到 .NET Core 3.0 和 Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite 到 3.0.0
使用 GeoAPI.Geometries 删除所有内容
将所有出现的几何接口(IGeometry、IPoint、ILineString 等)切换到它们相应的实现(Geometry、Point、LineString)。这也适用于数据库模型中的属性(它有效)。
另请参阅:从 1.x 升级到 2.0
注意: 目前 (2019-11-22) 有一个错误阻止您将大型几何图形保存到 sql server。这里有一个未解决的问题:https : //github.com/aspnet/EntityFrameworkCore/issues/18813
注 2: 上述错误已在 .NET 5 中修复