1

I have a c# project (lets name it A) that references two projects (B and C) which themselves each reference different projects (B => D and C => E), but D and E contain types that are named exactly the same. This causes the following error

Severity Code Description Project File Line Suppression State Error CS0433 The type 'ITokenProviderService' exists in both 'interfaces.dotNet6, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'interfaces.dotNetStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' UploaderServiceApplication C:\UploaderServiceApplication\Worker.cs 100 Active

I have already tried aliasing as in Type exists in 2 assemblies but i seem to do it wrong since to use the alias in the root project A it seems the project has to be referenced directly from A which in my case somehow does not work.

Are there any suggestions to what i can do to fix this issue?

macman
  • 21
  • 6
  • 5
    you should use two different namespaces for the types. E.g. in Assembly D the type is named `D.MyType`, while in E it is named `E.MyType`. – MakePeaceGreatAgain Oct 13 '22 at 08:36
  • You need to add code, and better explain what you're doing. Aliasing should work, unless maybe you are dynamically loading assemblies at runtime, then it's some issue with your code. – BurnsBA Oct 13 '22 at 14:06
  • thanks, the naming of the namespaces was the problem :) – macman Oct 14 '22 at 07:30

0 Answers0