Ошибка при попытка использовать assembly.GetExportedTypes()

я, мягко говоря, в c# новичок и пока-что мало что понимаю. Была задача реализовать pluggable приложение, решил использовать mef, но получаю ошибку.

String addInDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "\\plug-in\\";
                Console.WriteLine(addInDir);
                string[] addInAssemblies = Directory.GetFiles(addInDir, "*.dll");
                var addInTypes = new List<IAddIn>();
                AppDomain ad2 = AppDomain.CreateDomain("PluginAD");
                    var q = from assembly in addInAssemblies.Select(Assembly.LoadFrom)
                        from type in assembly.GetExportedTypes()
                        where type.IsClass && typeof(IAddIn).IsAssignableFrom(type)
                        select ad2.CreateInstanceAndUnwrap(assembly.FullName, type.FullName);
                    Console.WriteLine("Найдено {0} подключаемых модулей! ", q.ToArray().Length);
                
                foreach (IAddIn t in q)
                {
                    Console.WriteLine("Модуль {0} доступен по {1}", t, RemotingServices.IsTransparentProxy(t) ? "ссылке" : "значению");
                    Console.WriteLine(t.DoSomething(5));
                    Console.WriteLine(new String('-', 45));
                }
                AppDomain.Unload(ad2);
                Console.ReadKey();

Точнее вот такой вот список ошибок. Проблема именно в этом куске кода, т.к без него все более-менее работает.

Необработанное исключение: System.IO.FileNotFoundException: Не удалось загрузить файл или сборку "System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" либо одну из их зависимостей. Не удается найти указанный файл.
   в System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
   в System.Reflection.RuntimeAssembly.GetExportedTypes()
   в Logginer.MainTable.<>c.<TService>b__1_0(Assembly assembly) в D:\WpfApp1\WpfApp1\MainTable.xaml.cs:строка 41
   в System.Linq.Enumerable.<SelectManyIterator>d__23`3.MoveNext()
   в System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   в System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   в System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   в Logginer.MainTable.TService() в D:\WpfApp1\WpfApp1\MainTable.xaml.cs:строка 44
   в Logginer.MainTable..ctor() в D:\WpfApp1\WpfApp1\MainTable.xaml.cs:строка 25
   в WpfApp1.MainWindow.Button_click(Object sender, RoutedEventArgs e) в D:\WpfApp1\WpfApp1\MainWindow.xaml.cs:строка 68
   в System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   в System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   в System.Windows.Controls.Primitives.ButtonBase.OnClick()
   в System.Windows.Controls.Button.OnClick()
   в System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   в System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   в System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   в System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   в System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   в System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
   в System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   в System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   в System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   в System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   в System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   в System.Windows.Input.InputManager.ProcessStagingArea()
   в System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   в System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   в System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   в System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   в System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   в MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   в MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   в System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   в System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   в System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   в MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   в MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   в System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   в System.Windows.Application.RunDispatcher(Object ignore)
   в System.Windows.Application.RunInternal(Window window)
   в WpfApp1.App.Main()
Программа "[19108] Logginer.exe" завершилась с кодом 0 (0x0).

Ответы (0 шт):