diff --git a/Source/Boxed.DotnetNewTest/Boxed.DotnetNewTest.csproj b/Source/Boxed.DotnetNewTest/Boxed.DotnetNewTest.csproj index 794e0077..aa7ecd0b 100644 --- a/Source/Boxed.DotnetNewTest/Boxed.DotnetNewTest.csproj +++ b/Source/Boxed.DotnetNewTest/Boxed.DotnetNewTest.csproj @@ -9,7 +9,7 @@ - 3.3.0 + 3.4.0 Muhammad Rehan Saeed (RehanSaeed.com) Muhammad Rehan Saeed (RehanSaeed.com) ASP.NET Core Dotnet New Test Boxed diff --git a/Source/Boxed.DotnetNewTest/DotnetNew.cs b/Source/Boxed.DotnetNewTest/DotnetNew.cs index 385d1dfe..7218eb69 100644 --- a/Source/Boxed.DotnetNewTest/DotnetNew.cs +++ b/Source/Boxed.DotnetNewTest/DotnetNew.cs @@ -17,7 +17,7 @@ public static class DotnetNew /// /// A type from the assembly used to find the directory path of the project to install. /// Name of the file. - /// A task representing the operation. + /// A representing the asynchronous operation. public static Task InstallAsync(string fileName) => InstallAsync(typeof(T).GetTypeInfo().Assembly, fileName); @@ -26,7 +26,7 @@ public static Task InstallAsync(string fileName) => /// /// The assembly used to find the directory path of the project to install. /// Name of the file. - /// A task representing the operation. + /// A representing the asynchronous operation. /// A file with the specified file name was not found. public static Task InstallAsync(Assembly assembly, string fileName) { @@ -55,7 +55,7 @@ public static Task InstallAsync(Assembly assembly, string fileName) /// The source. /// The timeout. Defaults to one minute. /// if set to true show the shell window instead of logging to output. - /// A task representing the operation. + /// A representing the asynchronous operation. public static async Task InstallAsync(string source, TimeSpan? timeout = null, bool showShellWindow = false) { if (source is null) @@ -76,6 +76,27 @@ await ProcessExtensions } } + /// + /// Reinitialises the dotnet new command. + /// + /// The timeout. Defaults to one minute. + /// if set to true show the shell window instead of logging to output. + /// A representing the asynchronous operation. + public static async Task ReinitialiseAsync(TimeSpan? timeout = null, bool showShellWindow = false) + { + using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1))) + { + await ProcessExtensions + .StartAsync( + DirectoryExtensions.GetCurrentDirectory(), + "dotnet", + $"new --debug:reinit", + showShellWindow, + cancellationTokenSource.Token) + .ConfigureAwait(false); + } + } + private static string GetFilePath(Assembly assembly, string projectName) { string projectFilePath = null;