Omnisharp无法解决Microsoft.Extensions.DependencyInjection

我在dotnet core 3.0.100中编写webapi时正在使用VSCode。当我尝试构建以下代码(ServiceTool.ServiceProvider为IServiceProvider)

ServiceTool.ServiceProvider.GetService<Stopwatch>();

我遇到以下错误:

error CS0308: The non-generic method 'IServiceProvider.GetService(Type)' cannot be used with type arguments

下面的使用定义问题解决后:

using microsoft.Extensions.DependencyInjection;

为什么vscode(omnisharp)不建议使用?

baoyixinger 回答:Omnisharp无法解决Microsoft.Extensions.DependencyInjection

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3074142.html

大家都在问