diff --git a/src/GitReleaseManager.Cli/Program.cs b/src/GitReleaseManager.Cli/Program.cs index f89fc72d..dc44e89c 100644 --- a/src/GitReleaseManager.Cli/Program.cs +++ b/src/GitReleaseManager.Cli/Program.cs @@ -202,17 +202,15 @@ private static void RegisterVcsProvider(BaseVcsOptions vcsOptions, IServiceColle Log.Information("Using {Provider} as VCS Provider", vcsOptions.Provider); if (vcsOptions.Provider == VcsProvider.GitLab) { - var gitlabClient = new GitLabClient("https://gitlab.com", vcsOptions.Token); serviceCollection - .AddSingleton() - .AddSingleton(gitlabClient); + .AddSingleton((_) => new GitLabClient("https://gitlab.com", vcsOptions.Token)) + .AddSingleton(); } else { // default to Github - var gitHubClient = new GitHubClient(new ProductHeaderValue("GitReleaseManager")) { Credentials = new Credentials(vcsOptions.Token) }; serviceCollection - .AddSingleton(gitHubClient) + .AddSingleton((_) => new GitHubClient(new ProductHeaderValue("GitReleaseManager")) { Credentials = new Credentials(vcsOptions.Token) }) .AddSingleton(); } }