Understand plugins
This commit is contained in:
parent
5e0e3723b4
commit
323d449772
@ -1,8 +1,23 @@
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
|
||||
var controllers = builder.Services.AddControllers();
|
||||
Console.WriteLine(Environment.CurrentDirectory);
|
||||
Console.WriteLine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
|
||||
var files = Directory.GetFiles($"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}/plugins");
|
||||
Console.WriteLine(files.Length);
|
||||
foreach (var file in files)
|
||||
{
|
||||
Console.WriteLine(file);
|
||||
var assembly = Assembly.LoadFrom(file);
|
||||
controllers = controllers.AddApplicationPart(assembly);
|
||||
}
|
||||
|
||||
// var assembly = Assembly.LoadFrom("pluginA.dll");
|
||||
// // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user