Skip to content

Commit c9f5314

Browse files
committedMar 28, 2024·
Clear all existing entries, including possible duplicates.
1 parent fb0809e commit c9f5314

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed
 

‎src/IKVM.Core.MSBuild.Tasks/GenerateDepsFileExtensions.cs

+5-6
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ void WriteDepsFile(DependencyContext context)
5757
new DependencyContextWriter().Write(context, wrt);
5858
}
5959

60+
/// <inheritdoc />
6061
public override bool Execute()
6162
{
6263
WriteDepsFile(BuildDependencyContext(ReadDepsFile()));
@@ -197,10 +198,9 @@ RuntimeAssetGroup BuildRuntimeLibraryRuntimeAssemblyGroupWithAdditional(Dependen
197198
// normalize Windows paths
198199
path = path.Replace('\\', '/');
199200

200-
// find existing runtime file and remove
201+
// find existing file and clear duplicates
201202
var file = runtimeFiles.FirstOrDefault(i => (i.Path ?? "") == path);
202-
if (file != null)
203-
runtimeFiles.Remove(file);
203+
runtimeFiles.RemoveAll(i => (i.Path ?? "") == path);
204204

205205
var assemblyVersion = addl.GetMetadata(METADATA_LIBRARY_ASSET_ASSEMBLYVERSION) ?? file?.AssemblyVersion;
206206
if (string.IsNullOrEmpty(assemblyVersion))
@@ -251,10 +251,9 @@ RuntimeAssetGroup BuildRuntimeLibraryNativeAssetGroupWithAdditional(DependencyCo
251251
// normalize Windows paths
252252
path = path.Replace('\\', '/');
253253

254-
// find existing runtime file and remove
254+
// find existing file and clear duplicates
255255
var file = runtimeFiles.FirstOrDefault(i => (i.Path ?? "") == path);
256-
if (file != null)
257-
runtimeFiles.Remove(file);
256+
runtimeFiles.RemoveAll(i => (i.Path ?? "") == path);
258257

259258
var assemblyVersion = addl.GetMetadata(METADATA_LIBRARY_ASSET_ASSEMBLYVERSION) ?? file?.AssemblyVersion;
260259
if (string.IsNullOrEmpty(assemblyVersion))

0 commit comments

Comments
 (0)
Please sign in to comment.