Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit 0fe2e96

Browse files
thorgeirkzu
authored andcommitted
Remove duplicate files instead of throwing an exception.
Fixed spelling
1 parent 76e8482 commit 0fe2e96

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

src/Build/NuGet.Build.Packaging.Tasks/CreatePackage.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,11 @@ select item.GetNuGetTargetFramework()))
145145

146146
void AddFiles(Manifest manifest)
147147
{
148-
var contents = Contents.Where(item =>
149-
!string.IsNullOrEmpty(item.GetMetadata(MetadataName.PackagePath)));
150-
151-
var duplicates = contents.GroupBy(item => item.GetMetadata(MetadataName.PackagePath))
152-
.Where(x => x.Count() > 1)
153-
.Select(x => x.Key);
154-
155-
foreach (var duplicate in duplicates)
156-
{
157-
Log.LogErrorCode(nameof(ErrorCode.NG0012), ErrorCode.NG0012(duplicate));
158-
}
148+
// Remove duplicate files
149+
var contents = Contents
150+
.Where(item => !string.IsNullOrEmpty(item.GetMetadata(MetadataName.PackagePath)))
151+
.GroupBy(item => item.GetMetadata(MetadataName.PackagePath))
152+
.Select(x => x.First());
159153

160154
// All files need to be added so they are included in the nupkg
161155
manifest.Files.AddRange(contents

0 commit comments

Comments
 (0)