Home » c# » c# – Is it normal to have two different dependent assembly but have the same public key token?-Exceptionshub

c# – Is it normal to have two different dependent assembly but have the same public key token?-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

System.IO.FileSystem.Primitives -> b03f5f7f11d50a3a

System.Runtime.CompilerServices.Unsafe -> b03f5f7f11d50a3a

<dependentAssembly>
            <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>

I have this error:

An assembly with the same identity ‘System.IO.FileSystem.Primitives,
Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a‘ has
already been imported. Try removing one of the duplicate references.

How to&Answers:

Yes, this is normal; the key-token here is the thumbprint of the key used to strong-name the assembly – it isn’t unique to the assembly itself (unless the library author created a key and only used it to sign one assembly). In the case of system assemblies, they are all usually signed by the same key (or small set of keys). b03f5f7f11d50a3a is a very well known key token – it is even mentioned in the ECMA-335 specification.

Answer:

I manage to solve this error by removing the references of System.IO.FileSystem.Primitives in the project References section, but kept the nuget package installed

Use this link
https://github.com/dotnet/sdk/issues/1539#issuecomment-427397310