Folks,

I am in the unenviable position of being forced to reference two different
assemblies with the same type and namespace defined in both assemblies.
Needless to say, this ambiguity is a bit perplexing for the poor C#
compiler. Fortunately, MS has foreseen this problem, and has provided a
workaround - you can assign an alias to an assembly reference, and then use
the alias in your C# code to disambiguate which type you mean. For the
details, look up "extern alias" in the MSDN library.

At the csc.exe command line, an alias reference looks like this:

/r:GridV1=grid.dll

/r:GridV2=grid20.dll
In Visual Studio, you just set "Aliases" in the property grid for an
assembly reference, which produces the following bit in the .csproj file:

    <Reference Include="grid, Version=4.4.2848.18442, Culture=neutral,
PublicKeyToken=af2cd47db69d93bd, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\grid.dll</HintPath>
      <Aliases>GridV1</Aliases>
    </Reference>

My problem is that I can't find any way to specify an alias for an assembly
reference in NAnt. Is this possible? I'll take anything that means I don't
have to convert my build script to MSBuild. Beta version, whatever. I guess
I can call csc.exe from an <exec> task if nothing else works, but I'd love a
more elegant solution. Any help would be greatly appreciated.

  - Joel
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to