AssemblyResolverBase.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace HybridCLR.Editor.Meta
  7. {
  8. public abstract class AssemblyResolverBase : IAssemblyResolver
  9. {
  10. public string ResolveAssembly(string assemblyName, bool throwExIfNotFind)
  11. {
  12. if (TryResolveAssembly(assemblyName, out string assemblyPath))
  13. {
  14. return assemblyPath;
  15. }
  16. if (throwExIfNotFind)
  17. {
  18. if (SettingsUtil.HotUpdateAssemblyNamesIncludePreserved.Contains(assemblyName))
  19. {
  20. throw new Exception($"resolve Hot update dll:{assemblyName} failed! Please make sure that this hot update dll exists or the search path is configured in the external hot update path.");
  21. }
  22. else
  23. {
  24. throw new Exception($"resolve AOT dll:{assemblyName} failed! Please make sure that the AOT project has referenced the dll and generated the trimmed AOT dll correctly.");
  25. }
  26. }
  27. return null;
  28. }
  29. protected abstract bool TryResolveAssembly(string assemblyName, out string assemblyPath);
  30. }
  31. }