Пример #1
0
        public void Dispose()
        {
            var task = DirectoryExtended.TryDeleteDirectory(this.DirectoryPath);

            task.Wait();
            if (!task.Result)
            {
                Debug.WriteLine($"Failed to delete directory {this.DirectoryPath}");
            }
        }
Пример #2
0
        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)));
        }
Пример #3
0
 public TempDirectory(string directoryPath)
 {
     this.DirectoryPath = directoryPath;
     DirectoryExtended.CheckCreate(this.DirectoryPath);
 }
Пример #4
0
 public void Dispose() =>
 DirectoryExtended.SafeDelete(this.DirectoryPath);
Пример #5
0
 public static Task DotnetNewInstall(string source, TimeSpan?timeout = null) =>
 ProcessAssert.AssertStart(
     DirectoryExtended.GetCurrentDirectory(),
     "dotnet",
     $"new --install \"{source}\"",
     timeout ?? TimeSpan.FromSeconds(20));
Пример #6
0
 public static TempDirectory GetTempDirectory() =>
 new TempDirectory(DirectoryExtended.GetTempDirectoryPath());
Пример #7
0
 public static Task DotnetNewInstall(string source, TimeSpan?timeout = null) =>
 ProcessAssert.AssertStart(
     DirectoryExtended.GetCurrentDirectory(),
     "dotnet",
     $"new --install \"{source}\"",
     CancellationTokenFactory.GetCancellationToken(timeout));