I am using the new mef 2.0 framework however I am having issues loading an Assembly by name. I want to load the assembly by name, and not the path. Could someone point me in the right direction. I am using windows 10 operating system.
private void frmMef2UnitTest_Load(object sender, EventArgs e)
{
ComposeParts();
}
static void ComposeParts()
{
IList
var executingAssembly = Assembly.GetExecutingAssembly();
assemblies.Add(Assembly.GetExecutingAssembly());
assemblies.Add(Assembly.Load("HelloWorld")); // I get the error at this line
var loader = new MefLoader(assemblies);
loader.ComposeAllParts();
}
David SmithPosted Oct 23, 2016, 10:12 PM
I found out what I was doing wrong. I had to reference my plugin assembly project in the Mef2UnitTest Startup Project. Mef2UnitTest is my main host and thats were I am loading all of the mef plugins. I was on the slow bus. The moment when you start coding fast, and you make a simple mistake.Review the screenshot below
Is this the robust way to do this as a plugin architecture.
private void frmMef2UnitTest_Load(object sender, EventArgs e)
assemblies = new List(3);
{
ComposeParts();
}
static void ComposeParts()
{
IList
var executingAssembly = Assembly.GetExecutingAssembly();
assemblies.Add(Assembly.GetExecutingAssembly());
assemblies.Add(Assembly.Load("HelloWorld")); /
var loader = new MefLoader(assemblies);
loader.ComposeAllParts();
}