我通过编辑 settings.json 文件将 Windows 上的 bash 添加到 Windows 终端,当我尝试编译用 c++ 编写的简单 hello world 时,它会抛出错误,未检测到 gcc 或 g++ 如何正确添加 MSYS bash 终端,以便我可以从 Windows 终端编译文件
在 settings.json 中,我添加了 bash shell 的路径,如下所示:
{
"commandline": "powershell.exe",
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"hidden": false,
"name": "Windows PowerShell"
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
{
"commandline": "C:\\msys64\\usr\\bin\\bash.exe -i -l",
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"hidden": false,
"name": "msys2"
},
{
"guid": "{495d29da-4bfb-4956-abd8-ed1760703232}",
"commandline": "cmd.exe",
"hidden": false,
"name": "cmd.exe"
}
Run Code Online (Sandbox Code Playgroud) 我正在扩展身份服务器以使用自定义身份服务器实现
public static void UseMongoDbForIdentityServer(this IApplicationBuilder app)
{
//Resolve Repository with ASP .NET Core DI help
var repository = (IRepository)app.ApplicationServices.GetService(typeof(IRepository));
//Resolve ASP .NET Core Identity with DI help
var userManager = (UserManager<ApplicationUser>)app.ApplicationServices.GetService(typeof(UserManager<ApplicationUser>));
// --- Configure Classes to ignore Extra Elements (e.g. _Id) when deserializing ---
ConfigureMongoDriver2IgnoreExtraElements();
var createdNewRepository = false;
...
}
Run Code Online (Sandbox Code Playgroud)
这是我的启动文件的样子
public void ConfigureServices(IServiceCollection services)
{
services.Configure<ConfigurationOptions>(Configuration);
...
services.AddIdentityServer(
options =>
{
options.Events.RaiseSuccessEvents = true;
options.Events.RaiseFailureEvents = true;
options.Events.RaiseErrorEvents = true;
}
)
.AddMongoRepository()
.AddMongoDbForAspIdentity<ApplicationUser, IdentityRole>(Configuration)
.AddClients()
.AddIdentityApiResources() …
Run Code Online (Sandbox Code Playgroud)