Hi Joel.

 

A suggestion for a backup plan - in case you don't find any other
solution.

 

I use NAnt to drive all my builds, but use MSBuild to do the .NET
compilation step. Since Visual Studio maintains the MSBuild file
automatically, this reduces the amount of maintenance needed.

 

Here are relevant pieces of a typical build file.

 

Up the top, make sure we have access to MSBuild.exe and fail the build
with a suitable message if missing.

 

  <property name="msbuild.dir" 

            value="C:\WINDOWS\Microsoft.NET\Framework\v3.5"/>

  <fail message="MSBuild not fould in ${msbuild.dir}" 

        unless="${file::exists( path::combine(msbuild.dir,
'MSBuild.exe'))}"/>

 

 

Then, a target to do just one compilation at a time.

        

  <target name="compile.assemblies">

 

    <exec program="${msbuild.dir}\MSBuild.exe">

      <arg file="MySolution.sln"/>

      <arg value="/t:rebuild"/>

      <arg value="/verbosity:quiet"/>

    </exec>

    

  </target>

 

 

Hope this is helpful,

Bevan.

 

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Joel
Sent: Thursday, 19 June 2008 10:19 a.m.
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Help: csc and extern alias

 

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



******************************************************************************
"This message (and any files transmitted with it) are confidential and
may be legally privileged. If you are not the intended recipient please
notify the sender immediately and delete this message from your system.

This message does not necessarily reflect the views of the
Reserve Bank of New Zealand. If the recipient has any concerns about
the content of this message they should seek alternative confirmation
from the Reserve Bank of New Zealand."
******************************************************************************
-------------------------------------------------------------------------
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