当使用后台任务启动项目时,Visual Studio代码在另一个终端中运行另一个任务

时间:2017-11-27 15:04:50

标签: terminal visual-studio-code task

我查看了如何在VS代码中设置tasks的文档。但是在启动已经在后台运行任务的项目时,还不清楚如何在另一个终端中运行第二个任务

我目前在tasks.json中定义了一个构建任务,runs on launching项目与F5

但我想运行另一个在打开另一个终端时运行npm脚本的任务。例如

    var cert = new X509Certificate2(Path.Combine(_currentEnvironment.ContentRootPath, "Cert\\Cert.pfx"), "123456");
            services.AddIdentityServer()
                .AddInMemoryApiResources(Config.GetApisResources())
                .AddSigningCredential(cert)
                .AddInMemoryClients(Config.GetClients())
                .AddInMemoryPersistedGrants()
                .AddInMemoryIdentityResources(Config.GetIdentityResources())
                .Services.AddTransient<IResourceOwnerPasswordValidator, ResourceOwnerPasswordValidator>();


public class Config
    {
        public static IEnumerable<IdentityResource> GetIdentityResources()
        {
            return new List<IdentityResource>
            {
                new IdentityResources.OpenId(),
                new IdentityResources.Profile(),
            };
        }
        public static IEnumerable<ApiResource> GetApisResources()
        {
            return new[]
            {
                // simple API with a single scope (in this case the scope name is the same as the api name)
                new ApiResource("API", "api system"),

            };
        }


        public static IEnumerable<Client> GetClients()
        {
            return new List<Client>
            {
                new Client
                {
                    ClientId = "UI",
                    AllowedGrantTypes = GrantTypes.ResourceOwnerPasswordAndClientCredentials,
                    AccessTokenLifetime = 300,

                    AllowOfflineAccess=true,
                    RefreshTokenExpiration = TokenExpiration.Absolute,
                    AbsoluteRefreshTokenLifetime = 999999,
                    RefreshTokenUsage=TokenUsage.ReUse,
                    AccessTokenType=AccessTokenType.Jwt,

                    ClientSecrets =
                    {
                        new Secret("secretKey".Sha256())
                    },

                    AllowedScopes =
                    {
                        "API",
                        IdentityServerConstants.StandardScopes.OfflineAccess
                    }
                }
            };
        }
    }

在另一个终端打开意味着,它可以单独杀死,而不会影响原始后台任务。

0 个答案:

没有答案