Files
Hua.DotNet.Code/Helper/AssemblyHelper.cs

22 lines
631 B
C#

using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
namespace Hua.DotNet.Code.Helper;
public static class AssemblyHelper
{
public static List<Assembly> GetAllAssembliesInFolder(string folderPath, SearchOption searchOption)
{
return (from s in Directory.EnumerateFiles(folderPath, "*.*", searchOption)
where s.EndsWith(".dll") || s.EndsWith(".exe")
select s).Select(Assembly.LoadFile).ToList();
}
public static string? InformationalVersion(this Assembly assembly)
{
return assembly?.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
}
}