From c9f53144fe5e1ffb4ade3243f857a80dcbbac257 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Wed, 27 Mar 2024 20:36:07 -0500 Subject: [PATCH] Clear all existing entries, including possible duplicates. --- .../GenerateDepsFileExtensions.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/IKVM.Core.MSBuild.Tasks/GenerateDepsFileExtensions.cs b/src/IKVM.Core.MSBuild.Tasks/GenerateDepsFileExtensions.cs index ddef25d..d181d3c 100644 --- a/src/IKVM.Core.MSBuild.Tasks/GenerateDepsFileExtensions.cs +++ b/src/IKVM.Core.MSBuild.Tasks/GenerateDepsFileExtensions.cs @@ -57,6 +57,7 @@ void WriteDepsFile(DependencyContext context) new DependencyContextWriter().Write(context, wrt); } + /// public override bool Execute() { WriteDepsFile(BuildDependencyContext(ReadDepsFile())); @@ -197,10 +198,9 @@ RuntimeAssetGroup BuildRuntimeLibraryRuntimeAssemblyGroupWithAdditional(Dependen // normalize Windows paths path = path.Replace('\\', '/'); - // find existing runtime file and remove + // find existing file and clear duplicates var file = runtimeFiles.FirstOrDefault(i => (i.Path ?? "") == path); - if (file != null) - runtimeFiles.Remove(file); + runtimeFiles.RemoveAll(i => (i.Path ?? "") == path); var assemblyVersion = addl.GetMetadata(METADATA_LIBRARY_ASSET_ASSEMBLYVERSION) ?? file?.AssemblyVersion; if (string.IsNullOrEmpty(assemblyVersion)) @@ -251,10 +251,9 @@ RuntimeAssetGroup BuildRuntimeLibraryNativeAssetGroupWithAdditional(DependencyCo // normalize Windows paths path = path.Replace('\\', '/'); - // find existing runtime file and remove + // find existing file and clear duplicates var file = runtimeFiles.FirstOrDefault(i => (i.Path ?? "") == path); - if (file != null) - runtimeFiles.Remove(file); + runtimeFiles.RemoveAll(i => (i.Path ?? "") == path); var assemblyVersion = addl.GetMetadata(METADATA_LIBRARY_ASSET_ASSEMBLYVERSION) ?? file?.AssemblyVersion; if (string.IsNullOrEmpty(assemblyVersion))