MEF load plugin from directory

var catalog = new AggregateCatalog();
catalog.Catalogs.Add(new DirectoryCatalog("."));
var container = new CompositionContainer(catalog);
var catalog = new AggregateCatalog();
catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
catalog.Catalogs.Add(new DirectoryCatalog("."));
var container = new CompositionContainer(catalog);
public void AssembleCalculatorComponents()
        {

            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins");
            Console.WriteLine(path);
            //Check the directory exists
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            Console.WriteLine(path);
            string assemblyName = Assembly.GetEntryAssembly().FullName;
            Console.WriteLine(assemblyName);
            //Create an assembly catalog of the assemblies with exports
            var catalog = new AggregateCatalog(
                new AssemblyCatalog(Assembly.GetExecutingAssembly().Location),
                new AssemblyCatalog(Assembly.Load(assemblyName)),
                new DirectoryCatalog(path, "*.dll"));

            //Create a composition container
            var container = new CompositionContainer(catalog);
            container.ComposeParts(this);
时间: 2024-11-17 17:58:59

MEF load plugin from directory的相关文章

jquery的延迟加载插件Lazy Load Plugin for jQuery

下载:https://github.com/tuupola/jquery_lazyload 使用:http://www.appelsiini.net/projects/lazyload 翻译:http://www.neoease.com/lazy-load-jquery-plugin-delay-load-image/ http://stylechen.com/lazy-load.html demo:http://www.appelsiini.net/projects/lazyload/enab

Lazy Load, 延迟加载图片的 jQuery 插件

本文翻译自 Lazy Load Plugin for jQuery, 介绍一个 jQuery 插件, 它提供懒汉式加载页面图片的功能. Lazy Load 是一个用 JavaScript 编写的 jQuery 插件. 它可以延迟加载长页面中的图片. 在浏览器可视区域外的图片不会被载入, 直到用户将页面滚动到它们所在的位置. 这与图片预加载的处理方式正好是相反的. 在包含很多大图片长页面中延迟加载图片可以加快页面加载速度. 浏览器将会在加载可见图片之后即进入就绪状态. 在某些情况下还可以帮助降低服

The ultimate jQuery Plugin List(终极jQuery插件列表)

下面的文章可能出自一位奥地利的作者,  列出很多jQuery的插件.类似的网站:http://jquerylist.com/原文地址: http://www.kollermedia.at/archive/2007/11/21/the-ultimate-jquery-plugin-list/ jQuery is definitely my favourite Javascript Library and this ultimate jQuery Plugin List is for all oth

remmina failed to load rdp plugins in kali linux

安装remmina新建主机的时候发现protocol下拉列表里面没有rdp 1, 检查rdp plugins确认已安装: [email protected]:~# dpkg -l|grep remmina|grep rdpii  remmina-plugin-rdp                      1.0.0-4+deb7u1                     i386         RDP plugin for remmina remote desktop client---

OPENVPN搭建与配置

Content-type: text/html; charset=UTF-8 openvpn Section: Maintenance Commands (8)Updated: 17 November 2008Index Return to Main Contents NAME openvpn - secure IP tunnel daemon. SYNOPSIS openvpn [ options ... ] INTRODUCTION OpenVPN is an open source VPN

【转】 svn 错误 以及 中文翻译

直接Ctrl+F 搜索你要找的错 # # Simplified Chinese translation for subversion package # This file is distributed under the same license as the subversion package. # # Update to new pot: # msgmerge --update zh_CN.po subversion.pot # # Check translation: # msgfmt

mysql5.6配置文件详解(一)

mysqld  Ver 5.6.11 for Linux on x86_64 (Source distribution)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of the

O01-Linux CentOS7中利用RDO部署OpenStack图文教程

一.前言 1.RDO是红帽Red Hat 的一个开源项目,全称是RPM Distribution of OpenStack,能够帮助我们快捷部署OpenStack项目. 官方部署文档:https://www.rdoproject.org/install/packstack/ 2.本次安装基本是完全按照官方文档的步骤来操作的,除了第二部分安装前环境准备中的第3点.本次部署的是单节点的实验环境,版本是最新稳定版Queens. 另外,根据官方文档描述的,RDO也可用于部署多节点环境. 3.测试的环境:

x3D 下载以及如何使用原版NetBeans IDE 来搭建x3d编辑环境

安装前: Overview X3D-Edit version 3.3 standalone application and Netbeans plugin are available and ready. X3D-Edit is written using Java 8 for Netbeans 8 platform. X3D-Edit runs on desktop/laptop/tablet systems and is portable across major operating sys