public void Dispose() { var task = DirectoryExtended.TryDeleteDirectory(this.DirectoryPath); task.Wait(); if (!task.Result) { Debug.WriteLine($"Failed to delete directory {this.DirectoryPath}"); } }
public static Task DotnetPublish( this Project project, string framework = null, string runtime = null, bool? noRestore = true, TimeSpan? timeout = null) { var frameworkArgument = framework == null ? null : $"--framework {framework}"; var runtimeArgument = runtime == null ? null : $"--self-contained --runtime {runtime}"; var noRestoreArgument = noRestore == null ? null : "--no-restore"; DirectoryExtended.CheckCreate(project.PublishDirectoryPath); return ProcessAssert.AssertStart( project.DirectoryPath, "dotnet", $"publish {noRestoreArgument} {frameworkArgument} {runtimeArgument} --output {project.PublishDirectoryPath}", CancellationTokenFactory.GetCancellationToken(timeout)); }
public static Task DotnetNewInstall(string source, TimeSpan?timeout = null) => ProcessAssert.AssertStart( DirectoryExtended.GetCurrentDirectory(), "dotnet", $"new --install \"{source}\"", CancellationTokenFactory.GetCancellationToken(timeout));
public static TempDirectory GetTempDirectory() => new TempDirectory(DirectoryExtended.GetTempDirectoryPath());
public TempDirectory(string directoryPath) { this.DirectoryPath = directoryPath; DirectoryExtended.CheckCreate(this.DirectoryPath); }