diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/AnnotatorBuildTask.cs b/TunnelVisionLabs.ReferenceAssemblyAnnotator/AnnotatorBuildTask.cs index 20f6c71..3258d0e 100644 --- a/TunnelVisionLabs.ReferenceAssemblyAnnotator/AnnotatorBuildTask.cs +++ b/TunnelVisionLabs.ReferenceAssemblyAnnotator/AnnotatorBuildTask.cs @@ -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 diff --git a/TunnelVisionLabs.ReferenceAssemblyAnnotator/WindowsErrorCode.cs b/TunnelVisionLabs.ReferenceAssemblyAnnotator/WindowsErrorCode.cs new file mode 100644 index 0000000..64e8d7d --- /dev/null +++ b/TunnelVisionLabs.ReferenceAssemblyAnnotator/WindowsErrorCode.cs @@ -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 + { + /// + /// https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-#error_file_exists + /// + FileExists = 80, + } +}