Use PluginLoader in the Plugin packer to prevent conflicts (#4277)

This commit is contained in:
Nicolas Dorier
2022-11-09 23:28:16 +09:00
committed by GitHub
parent 562f88555c
commit a374e351e2
2 changed files with 4 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using BTCPayServer.Abstractions.Contracts;
using McMaster.NETCore.Plugins;
using NBitcoin.Crypto;
using NBitcoin.DataEncoders;
using NBitcoin.Secp256k1;
@@ -33,7 +34,8 @@ namespace BTCPayServer.PluginPacker
throw new Exception($"{rootDLLPath} could not be found");
}
var assembly = Assembly.LoadFrom(rootDLLPath);
var plugin = PluginLoader.CreateFromAssemblyFile(rootDLLPath, false, new[] { typeof(IBTCPayServerPlugin) });
var assembly = plugin.LoadAssembly(name);
var extension = GetAllExtensionTypesFromAssembly(assembly).FirstOrDefault();
if (extension is null)
{