【问题标题】:How can I embed a dll to the output assembly with codedom, and use it as reference using C#?如何使用 codedom 将 dll 嵌入到输出程序集中,并使用 C# 将其用作参考?
【发布时间】:2017-02-10 18:27:23
【问题描述】:

我有一个类库 dll,我生成的程序将使用它,例如像这个 DLL.Do.Something(1);所以我必须将此 dll 添加到 codedom 以将其嵌入程序中并将其设置为参考。但我不知道该怎么做,没有人帮助我......

【问题讨论】:

  • 为什么你认为他们没有帮助你?也许你应该阅读网站的规则,“这里问什么/如何问”

标签: c# dll reference embed codedom


【解决方案1】:

这个问题有一些令人困惑的事情。 - 你有第三方 dll 吗?为什么不能正常引用呢? - 您可以使用 Assembly 对象将 dll 动态加载到您的域中,而无需将其字符串引用为:

        Assembly assembly = Assembly.LoadFrom(sPath); 

您可以从该程序集中获取类型,也可以使用激活器来创建实例

但说实话,这个问题太模糊了

祝你好运

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-02
    • 1970-01-01
    • 2011-05-20
    • 1970-01-01
    • 1970-01-01
    • 2012-06-12
    • 2011-08-28
    相关资源
    最近更新 更多