How to reference a namespace from a specific assembly?

前端 未结 2 1885
鱼传尺愫
鱼传尺愫 2020-12-25 12:23

So here is my problem.

  • My (test) project references both Castle Windsor and Rhino Mocks.
  • I am creating a class which implements Castle.Core.Intercept
相关标签:
2条回答
  • 2020-12-25 12:53

    You can use an extern alias to alias one of the assemblies to prevent the ambiguity.

    0 讨论(0)
  • 2020-12-25 13:06

    Let's throw the specific answer up here in case someone comes along later. From article here.

    • Select one of the two assemblies under project references (in my case I selected Castle.Core). Hit F4 to bring up properties and enter alias CastleCore
    • At the top of the problematic cs file put extern alias CastleCore;
    • Reference your class with CastleCore::Castle.Core.Interceptors.IInterceptor. Or in my case I simply did:

    using cci = CastleCore::Castle.Core.Interceptors;

    and can now reference

    cci.IInterceptor
    
    0 讨论(0)
提交回复
热议问题