Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17110 for trunk


Ignore:
Timestamp:
07/08/19 15:13:43 (5 years ago)
Author:
abeham
Message:

#2435: added filter to include only assemblies of most recent version in case multiple versions exist

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Scripting/3.3/Script.cs

    r16565 r17110  
    2929using System.Reflection;
    3030using System.Text;
     31using System.Text.RegularExpressions;
     32using HEAL.Attic;
    3133using HeuristicLab.Common;
    3234using HeuristicLab.Common.Resources;
    3335using HeuristicLab.Core;
    34 using HEAL.Attic;
    3536using Microsoft.CSharp;
    3637
     
    122123
    123124    public virtual IEnumerable<Assembly> GetAssemblies() {
    124       var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(a => !a.IsDynamic && File.Exists(a.Location)).ToList();
     125      var assemblies = AppDomain.CurrentDomain.GetAssemblies()
     126        .Where(a => !a.IsDynamic && File.Exists(a.Location))
     127        .GroupBy(x => Regex.Replace(Path.GetFileName(x.Location), @"-[\d.]+\.dll$", ""))
     128        .Select(x => x.OrderByDescending(y => y.GetName().Version).First())
     129        .ToList();
    125130      assemblies.Add(typeof(Microsoft.CSharp.RuntimeBinder.Binder).Assembly); // for dlr functionality
    126131      return assemblies;
Note: See TracChangeset for help on using the changeset viewer.