0

nant 中设置要使用哪个版本的 MSBuild 的配置设置在哪里?

Nant 在需要使用 4.0 的时候想使用 3.5。

4

2 回答 2

1

几年前,我写了一篇博客文章,解释了如何从您的 NAnt 构建脚本中利用任何版本的 MSBuild。本质上,您将使用该<exec>节点来调用 MSBuild,因为它安装在您的计算机上。

http://enterpriseyness.com/2009/12/continuous-integration-with-cruise-control-net-nant/

<target name=”build”&gt;
  <exec program=”${MSBuildPath}”&gt;
    <arg line=’”${SolutionFile}”‘ />
    <arg line=”/property:Configuration=${SolutionConfiguration}” />
    <arg value=”/target:Rebuild” />
    <arg value=”/verbosity:normal” />
    <arg value=”/nologo” />
    <arg line=’/logger:”C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll”‘/>
  </exec>
</target>
于 2012-06-19T16:32:58.917 回答
0

您还可以创建 NAnt 框架配置。如果您编辑 NAnt.exe.config 文件,请复制其中一个<framework>元素及其所有子元素。更改frameworkdirectory以使用您要使用的 MSBuild 的版本号。您可以查看其他<framework>元素以了解正确用法。例如,如果您想让“net-3.5”<framework>元素使用 MSBuild 4.0,只需将重复的<framework>打开元素更改为如下所示:

<framework 
    name="net-3.5-msbuild-4.0"
    family="net"
    version="3.5"
    description="Microsoft .NET Framework 3.5 with MSBuild 4.0"
    sdkdirectory="${sdkInstallRoot}"
    frameworkdirectory="${path::combine(installRoot, 'v4.0.30319')}"
    frameworkassemblydirectory="${path::combine(installRoot, 'v2.0.50727')}"
    clrversion="2.0.50727"
    clrtype="Desktop"
    vendor="Microsoft"
    ><!-- Rest of framework contents here --></framework>

frameworkdirectory请注意属性中的不同版本号。

然后指定要在 NAnt 中使用的框架。

<property name="nant.settings.currentframework" value="net-3.5-msbuild-4.0" />
于 2013-12-31T19:13:42.787 回答