diff --git a/build/repo.targets b/build/repo.targets
index b0e1916ba5..1349205d8e 100644
--- a/build/repo.targets
+++ b/build/repo.targets
@@ -39,10 +39,7 @@
-
-
-
+ DestinationFolder="$(IntermediateMirrorPackageDir)" />
@@ -209,17 +206,14 @@
-
+ <_MirroredPackageFiles Include="$(IntermediateMirrorPackageDir)*.nupkg" />
-
-
-
-
+ DestinationFolder="$(ArtifactsDir)"
+ Overwrite="true" />
diff --git a/build/tasks/CopyPackagesToSplitFolders.cs b/build/tasks/CopyPackagesToSplitFolders.cs
index 9162492f6d..ebb1b37bf5 100644
--- a/build/tasks/CopyPackagesToSplitFolders.cs
+++ b/build/tasks/CopyPackagesToSplitFolders.cs
@@ -28,6 +28,8 @@ namespace RepoTasks
[Required]
public string DestinationFolder { get; set; }
+ public bool Overwrite { get; set; }
+
public override bool Execute()
{
if (Files?.Length == 0)
@@ -79,9 +81,14 @@ namespace RepoTasks
var destFile = Path.Combine(destDir, Path.GetFileName(file.ItemSpec));
- Log.LogMessage($"Copying {file.ItemSpec} to {destFile}");
+ if (!Overwrite && File.Exists(destFile))
+ {
+ Log.LogError($"File already exists in {destFile}");
+ continue;
+ }
- File.Copy(file.ItemSpec, destFile);
+ Log.LogMessage($"Copying {file.ItemSpec} to {destFile}");
+ File.Copy(file.ItemSpec, destFile, Overwrite);
expectedPackages.Remove(identity.Id);
}
@@ -97,7 +104,7 @@ namespace RepoTasks
return false;
}
- return true;
+ return !Log.HasLoggedErrors;
}
}
}