From fd234717df3c4acf681154126bcc951d716e8674 Mon Sep 17 00:00:00 2001 From: zabbius Date: Sat, 28 Jan 2023 00:58:34 +0300 Subject: [PATCH] Take last runtime if there are several --- src/Refasmer/Importer/Utils.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Refasmer/Importer/Utils.cs b/src/Refasmer/Importer/Utils.cs index 497dcde..12af5d1 100644 --- a/src/Refasmer/Importer/Utils.cs +++ b/src/Refasmer/Importer/Utils.cs @@ -69,7 +69,9 @@ private AssemblyReferenceHandle FindRuntimeReference() foreach (var runtimeName in RuntimeNames) { var runtimeRef = _reader.AssemblyReferences - .SingleOrDefault(r => _reader.GetString(_reader.GetAssemblyReference(r).Name) == runtimeName); + .Where(r => _reader.GetString(_reader.GetAssemblyReference(r).Name) == runtimeName) + .OrderByDescending(r => _reader.GetAssemblyReference(r).Version) + .FirstOrDefault(); if (!IsNil(runtimeRef)) return runtimeRef;