2008-11-29 35 views
9

我试图使用VS2008 SP1和x64 XP运行NAnt 0.86b1。NAnt和VS2008(.NET 3.5) - 不支持Solution.sln文件的解决方案格式

我有一个基本的构建文件(下面)给出了错误 不支持文件'Solution.sln'的解决方案格式。

<property name="nant.settings.currentframework" value="net-3.5" /> 

<target name="build" description="Full Rebuild" depends="clean,compile" /> 

<target name="clean" description="Cleans outputs"> 
    <delete dir="bin" failonerror="false" /> 
    <delete dir="obj" failonerror="false" /> 
</target> 

<target name="compile" description="Compiles solution"> 
    <solution configuration="debug" solutionfile="Solution.sln" /> 
</target> 

有其他人遇到这个问题?对此我找不到任何有用的东西。

回答

7

您会注意到文档指出NAnt的<solution>任务不支持比VS2003更新的解决方案文件。

我建议对所有比VS2003更新的项目使用the <msbuild> task from nantcontrib

此外,NAnt的.85版本只支持高达2.0的框架版本。使用3.5框架最简单的方法是使用NAnt的.86-beta1版本。然后,您可以使用针对3.5解决方案的<msbuild>任务。

7

nant-0.86-beta1支持3.5,但在解决方案节点中没有多好。我结束了使用这种从nantcontrib:

<target name="build" description="Compiles using the AutomatedDebug Configuration"> 
    <!-- <loadtasks assembly="C:\Dev\nant-0.86-beta1\bin\NAnt.Contrib.Tasks.dll" /> --> 
    <msbuild project="${Solution.Filename}"> 
     <property name="Configuration" value="Release"/> 
    </msbuild> 
    </target> 
+0

+1使用msbuild任务。自从我开始自动化我们的构建之后,我一直在玩这两个版本,并且msbuild只是更快启动和运行。我也认为使用实际的解决方案/项目文件来运行构建的想法只是一个'好主意',因为它意味着所有的构建信息都集中在一个地方。 (而不是有VS和Nant配置的解决方案/项目。) – 2009-08-26 13:30:07

2

Building the platform code with nant and VS2008

这是在这里堆栈溢出。基本上你只有几个选项,用项目构建文件,常用构建文件和主构建文件自己控制所有构建。或者运行Exec任务为每个需要编译的解决方案执行正确版本的MSBuild。