From 2fae2d0af04bad6d5c69b06679795b96a1ff4107 Mon Sep 17 00:00:00 2001 From: Charlie Poole Date: Fri, 10 Sep 2021 18:19:34 -0700 Subject: [PATCH] Fix error in build --- build.cake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build.cake b/build.cake index 1699a51..31aad92 100644 --- a/build.cake +++ b/build.cake @@ -133,8 +133,10 @@ Task("InstallNuGetPackage") .Does((parameters) => { // Ensure we aren't inadvertently using the chocolatey install - DeleteDirectory(parameters.ChocolateyInstallDirectory, new DeleteDirectorySettings() { Recursive = true }); + if (DirectoryExists(parameters.ChocolateyInstallDirectory)) + DeleteDirectory(parameters.ChocolateyInstallDirectory, new DeleteDirectorySettings() { Recursive = true }); + CreateDirectory(parameters.NuGetInstallDirectory); CleanDirectory(parameters.NuGetInstallDirectory); Unzip(parameters.NuGetPackage, parameters.NuGetInstallDirectory); @@ -171,8 +173,10 @@ Task("InstallChocolateyPackage") .Does((parameters) => { // Ensure we aren't inadvertently using the nuget install - DeleteDirectory(parameters.NuGetInstallDirectory, new DeleteDirectorySettings() { Recursive = true }); + if (DirectoryExists(parameters.NuGetInstallDirectory)) + DeleteDirectory(parameters.NuGetInstallDirectory, new DeleteDirectorySettings() { Recursive = true }); + CreateDirectory(parameters.ChocolateyInstallDirectory); CleanDirectory(parameters.ChocolateyInstallDirectory); Unzip(parameters.ChocolateyPackage, parameters.ChocolateyInstallDirectory);