【问题标题】:System.Security.Cryptography.HMACSHA1 exists in two assembly with same namespaceSystem.Security.Cryptography.HMACSHA1 存在于具有相同命名空间的两个程序集中
【发布时间】:2015-11-12 05:02:03
【问题描述】:

错误 CS0433 System.Security.Cryptography.Hashing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 和 System.Security.Cryptography.Primitives, Version=4.0.0.0 中都存在类型“HashAlgorithm” , Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

我创建了一个针对dnx46dnxcore50 的类库。当我引用 HashAlgorithm 类时,Visual Studio 2015 给了我上述错误。处理这种情况的通常方法是什么?使用外部别名?

【问题讨论】:

  • 最近发生了变化,其中一个程序集已过时。您应该检查 .NET Core 网站以查看应删除的内容。
  • @LexLi 感谢您回答我的问题。我也是这么想的。目前两者都存在于源代码中。

标签: c# asp.net-core .net-core


【解决方案1】:

尝试使用完全限定的名称,例如

System.Security.Cryptography.HashAlgorithm hashAlgorithm

或者您可以查看extern alias,同时检查以下问题:

Class with same name in two assemblies (intentionally)

Type exists in 2 assemblies

【讨论】:

  • 问题是两者都是相同的命名空间,只是 System.Security.Cryptography.HashAlgorithm
  • 谢谢。知道如何在 project.json 文件中添加编译选项
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-04-10
  • 1970-01-01
  • 2020-07-13
  • 1970-01-01
  • 1970-01-01
  • 2014-01-12
  • 2010-10-18
相关资源
最近更新 更多