【问题标题】:The type 'foo.Info.AgentDetails' exists in both 'foo.dll' and 'foo.dll'“foo.dll”和“foo.dll”中都存在“foo.Info.AgentDetails”类型
【发布时间】:2014-11-09 06:16:23
【问题描述】:

在我的 asp.net Web 应用程序中,我的页面之一,我将对象列表 (List<AgentDetails>) 存储到 ViewState。之后,当我尝试将其恢复为 (List<AgentDetails>)ViewState["ViewStateAgentDetails"] 时,我收到类似

的错误

“foo.dll”和“foo.dll”中都存在“foo.Info.AgentDetails”类型

我不明白这里发生了什么。 我被这个问题困住了。 有人可以帮我解决这个问题吗? 提前致谢。

【问题讨论】:

  • 删除foo.dll的所有引用,然后只添加一个引用并清理,重建,它应该可以工作。
  • @ArindamNayak 感谢您的回复,实际上 bin 目录只有一个 dll 副本。

标签: asp.net dll


【解决方案1】:

如果我从对我的评论的回答中正确解释它,我可以看到可能有其他一些 DLL,可以有不同的 dll 名称,如 bar.dll,但最终具有相同的命名空间和类名。所以要解决这个问题,找到第二个DLL,并使用extern或更改namespace来解决这个错误。

更多解释-http://blogs.msdn.com/b/abhinaba/archive/2005/11/30/498278.aspx

How do you allow two DLL's with same namespace.class to exist in the same application?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-21
    • 2019-03-03
    • 2022-01-16
    • 2020-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-01
    相关资源
    最近更新 更多