对 UseHttps 扩展方法的调用不明确

Ambiguous call for UseHttps extension method

在我的 ASP.NET Core 3.1 项目中,我在 Program.cs 中有以下配置:

using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

[...]

public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureWebHostDefaults(webBuilder =>
        {
            webBuilder.UseStartup<Startup>();
            webBuilder.ConfigureKestrel(options =>
            {
                options.Listen(IPAddress.Loopback, 5000, listenOptions =>
                {
                    listenOptions.UseHttps("debug.pfx", "password");
                });
            });
        })
        .ConfigureAppConfiguration((hostBuilderContext, config) =>
        {
            config.AddJsonFile("config-debug.json");
        });

引用的包:

<PackageReference Include="AutoMapper" Version="9.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.3">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.10" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" />
<PackageReference Include="MoodleLti" Version="0.1.0" />
<PackageReference Include="MoodleLti.DependencyInjection" Version="0.1.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.1" />
<PackageReference Include="System.Linq.Async" Version="4.0.0" />

编译它会产生以下错误消息:

Error CS0121: The call is ambiguous between the following methods or properties:
'Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions, string, string)' and
'Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions, string, string)'

...这对我来说意义不大。

我该如何解决这个问题?

此问题是由 NuGet 依赖项引起的,该依赖项具有另一个依赖项,其中包括 ASP.NET Core 2.0 包。这些包与 3.0 的包冲突,导致调用歧义错误。

我为受影响的库创建了一个问题,以添加 ASP.NET Core 3.0 支持。