【问题标题】:The type 'Expando' is defined in an assembly that is not referenced“Expando”类型是在未引用的程序集中定义的
【发布时间】:2015-11-04 07:23:10
【问题描述】:

我收到以下编译错误:

The type 'Expando' is defined in an assembly that is not referenced. 
You must add a reference to assembly 'Westwind.Utilities, Version=2.64.0.0, 
Culture=neutral, PublicKeyToken=6f7d66a3bb7de652'.  

问题是,我引用了那个版本的程序集...我认为问题出在类库上。

我的 ClassLibrary 有以下类:

public class Generic_AnswerFile : Expando { ... }

我的测试控制台有以下类:

public class Specific_AnswerFile : Generic_AnswerFile { ... }

Specific_AnswerFile 不会编译。任何想法为什么?这两个项目都是 .Net 4.0,并引用了正确的 .Net 4.0 版本的 Westwind.Utilities 2.64

【问题讨论】:

  • 如果您说两个项目都有引用,请检查 csproj 文件,检查引用的指定方式是否存在任何可能相关的差异。

标签: c# reference visual-studio-2015 .net-assembly


【解决方案1】:

Expando 类型是在他的程序集中定义的

这意味着仅在 GAC 中。虽然你有参考它..但它会无法加载。要正确加载它,您需要在您的配置文件中的程序集标签下定义它

<add assembly="Expando, Version=1.0.0.0, Culture=neutral, PublicKeyToken=[MyPublicKeyToken]"/>  

【讨论】:

    猜你喜欢
    • 2016-09-04
    • 2020-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-16
    相关资源
    最近更新 更多