2

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'

I make a class library targets both dnx46 and dnxcore50. When I reference HashAlgorithm class, visual studio 2015 give me above error. What is usual way to handle this situation? Use extern alias?

leppie
  • 115,091
  • 17
  • 196
  • 297
Yue Zhou
  • 41
  • 3
  • 1
    There is a change recently that one of the assemblies becomes obsolete. You should check .NET Core web site to see which should be removed. – Lex Li Aug 19 '15 at 04:16
  • 1
    @LexLi thanks to answer my question. I thought the same way. Both exists in the source code at the moment. – Yue Zhou Aug 19 '15 at 04:25

1 Answers1

2

Try to use a fully qualified name, like

System.Security.Cryptography.HashAlgorithm hashAlgorithm

or you can have a look at extern alias, also check these questions:

Class with same name in two assemblies (intentionally)

Type exists in 2 assemblies

Community
  • 1
  • 1
w.b
  • 11,026
  • 5
  • 30
  • 49