c# - System.Security.Cryptography.HMACSHA1 存在于具有相同命名空间的两个程序集中

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

Error CS0433 The type 'HashAlgorithm' exists in both System.Security.Cryptography.Hashing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Security.Cryptography.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

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

最佳答案

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

System.Security.Cryptography.HashAlgorithm hashAlgorithm

或者您可以查看extern alias ,还要检查这些问题:

Class with same name in two assemblies (intentionally)

Type exists in 2 assemblies

关于c# - System.Security.Cryptography.HMACSHA1 存在于具有相同命名空间的两个程序集中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32086297/

相关文章:

c# - Application Insight 中的范围日志记录

c# - C#对几个字符串使用相同的变量

c# - Oracle 存储过程、SYS_REFCURSOR 和 NHibernate

c# - 在ASP.NET Core中在 Controller OnActionExecuting之前执行全局过滤器

.net - 使用 `dotnet build` 或 `dotnet publish` 时如何为引用的项目指定构建配置?

c# - 不支持 'Microsoft.AspNetCore.Http.IHeaderDictionary' 上的集合类型 'Microsoft.AspNetCore.Http.IFormFile.Headers'

c# - 有没有更合适的方法来测试构造函数是否抛出异常?

c# - 使用 ADO.NET SqlDataAdapter 更新单个记录

web-services - Angular2 ASP.NET Core AntiForgeryToken

c# - 授权属性始终返回 401