vineri, 21 septembrie 2012

C#: Extern Aliases



  • If you have to reference types that have the same name and same namespace, you can use extern aliases to bypass this issue
  • Extern aliases also give you a way to access a single type from two (or more) different versions of the same assembly
  • To reference two assemblies with the same fully-qualified type names, an alias must be specified on the command line, as follows:
    /r:GridV1=grid.dll/r:GridV2=grid20.dllor

    From S
    olution Explorer -> Select Project -> References -> on the Grid -> Right-click -> Select Properties -> Change "Aliases" property:

  •  


  • Add the following directive to the top of the code file: extern alias GridV1;extern alias GridV2;