<msbuild>任务或 msbuild.exe 与 NAnt? [英] <msbuild> task or msbuild.exe with NAnt?

查看:18
本文介绍了<msbuild>任务或 msbuild.exe 与 NAnt?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看起来(至少)有两个选项可以让 nant 使用 csproj 文件:使用 NAntContrib 或直接使用 msbuild.exe(例如,codecampserver).我读对了吗?如果是这样,使用 msbuild.exe 比 NAntContrib 任务有什么优势?

It looks like there are (at least) two options for getting nant to use csproj files: using the task of NAntContrib or using msbuild.exe directly (e.g., codecampserver). Am I reading this right, and if so, what is the advantage of using msbuild.exe over the NAntContrib task?

推荐答案

NAntContrib 假定为 .NET Framework V2.0.如果要使用 .NET 3.5,则需要直接调用 MsBuild.exe.当您升级到新版本的 .NET 时,您只需修改 MSBuildPath 属性.

The NAntContrib assumes .NET Framework V2.0. If you want to use .NET 3.5, you'll need to call MsBuild.exe directly. As you upgrade to new versions of .NET, you need only modify the MSBuildPath property.

这是一个例子:

<property name="MSBuildPath" value="C:WINDOWSMicrosoft.NETFrameworkv3.5MSBuild.exe"/>    
<target name="build">
    <exec program="${MSBuildPath}">
        <arg line='"${SolutionFile}"' />
        <arg line="/property:Configuration=${SolutionConfiguration}" />
        <arg value="/target:Rebuild" />
        <arg value="/verbosity:normal" />
        <arg value="/nologo" />
        <arg line='/logger:"C:Program FilesCruiseControl.NETserverThoughtWorks.CruiseControl.MsBuild.dll"'/>
    </exec>
</target>

不同版本.NET的MSBuildPath值是

The value MSBuildPath for different versions of .NET are

  • 2.0、3.0 C:WindowsMicrosoft.NETFramework64v2.0.50727MSBuild.exe
  • 3.5 C:WindowsMicrosoft.NETFramework64v3.5MSBuild.exe
  • 4、4.5.x、4.6.x、4.7.x C:WindowsMicrosoft.NETFramework64v4.0.30319MSBuild.exe

对于 32 位版本,将 Framework64 更改为 Framework

For a 32-bit build, change Framework64 to Framework

更新跟进一些评论,value 属性用于没有空格字符的参数,而 line 用于包含空格的参数.否则,NAnt 将使用空格作为输入的结尾.

Update Following up on some of the comments, the value attribute is used for parameters that have no white space characters where as line is used for parameters that contain white spaces. Otherwise, the NAnt would use the space as an end of input.

这篇关于&lt;msbuild&gt;任务或 msbuild.exe 与 NAnt?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆