Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MEF and .NET Standard
var path = Path.Combine(AppContext.BaseDirectory, "Plugins");
var assemblies = Directory.GetFiles(path, "*.dll").Select(Assembly.LoadFile);
[Export(typeof(INodeDefinition))]
public class FileWriterNodeDefinition : INodeDefinition
var conventions = new ConventionBuilder();
conventions
.ForTypesDerivedFrom<INodeDefinition>()
.Export<INodeDefinition>()
.Shared();
var configuration = new ContainerConfiguration();
configuration.WithAssemblies(assemblies, conventions);
using (var container = configuration.CreateContainer())
{
var nodeDefinitions = container.GetExports<INodeDefinition>();
return nodeDefinitions;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.