Skip to content

Commit

Permalink
Skip copying documentation file when target already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jnm2 committed Jan 3, 2020
1 parent 8b67de6 commit fe47e42
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,14 @@ public override bool Execute()
string targetDocumentation = Path.ChangeExtension(outputAssembly, ".xml");
if (File.Exists(sourceDocumentation))
{
File.Copy(sourceDocumentation, targetDocumentation);
try
{
File.Copy(sourceDocumentation, targetDocumentation);
}
catch (IOException ex) when ((WindowsErrorCode)ex.HResult == WindowsErrorCode.FileExists)
{
}

GeneratedDocumentationFiles = new[] { new TaskItem(targetDocumentation) };
}
else
Expand Down
13 changes: 13 additions & 0 deletions TunnelVisionLabs.ReferenceAssemblyAnnotator/WindowsErrorCode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

namespace TunnelVisionLabs.ReferenceAssemblyAnnotator
{
internal enum WindowsErrorCode : ushort
{
/// <summary>
/// https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-#error_file_exists
/// </summary>
FileExists = 80,
}
}

0 comments on commit fe47e42

Please sign in to comment.