[英]Can't add IdentityServer4 NuGet package to ASP.NET Core project properly and VS Code is not showing intellisense
I've added IdentityServer4 NuGet package to ASP.NET core project using dotnet cli. 我已经使用dotnet cli将IdentityServer4 NuGet包添加到ASP.NET核心项目中。 Then written the following code on
Startup
class. 然后在
Startup
类上编写以下代码。
public void ConfigureServices(IServiceCollection services)
{
services.AddIdentityServer()
.AddInMemoryClients(new Client[]
{
new Client
{
ClientId = "react client",
ClientName = "React Client",
AllowedGrantTypes = GrantTypes.Implicit,
RedirectUrls = {"http://localhost:51009/"},
AllowedScopes = { "openid"}
}
});
services.AddMvc();
}
Then when I build the project it shows error: The type or namespace name 'Client' could not be found (are you missing a using directive or an assembly reference?)
然后,当我构建项目时,它显示错误:
The type or namespace name 'Client' could not be found (are you missing a using directive or an assembly reference?)
Moreover VS Code doesn't show any suggestion for IdentityServer related code. 此外,VS Code对与IdentityServer相关的代码没有任何建议。
And when I search IdentityServer4 on NuGet website it shows result like following: 当我在NuGet网站上搜索IdentityServer4时,结果如下:
And when I search IdentityServer4 on Visual Studio 2017 it shows result like following: 当我在Visual Studio 2017上搜索IdentityServer4时,它显示如下结果:
The IdentityServer4 Client class is located in the IdentityServer4.Models namespace which is included in the nuget-package. IdentityServer4 Client类位于nuget-package中包含的IdentityServer4.Models命名空间中。
Adding the using-statement where the model/models are needed should resolve the issue 在需要一个或多个模型的地方添加使用声明应可解决此问题
using IdentityServer4.Models
VS Code was not showing intellisense because of an OmniSharp bug. 由于OmniSharp错误,VS Code未显示智能感知。 Solution to this problem is restarting OmniSharp.
解决此问题的方法是重新启动OmniSharp。
Ctrl
+ Shift
+ P
and then type Restart OmniSharp
Ctrl
+ Shift
+ P
,然后键入Restart OmniSharp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.