Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip copying documentation file when target already exists #75

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
jnm2 marked this conversation as resolved.
Show resolved Hide resolved
{
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,
}
}