NAnt和VS2008(.NET 3.5) - 不支持解决方案格式的文件Solution.sln

Mr.*_*ble 9 nant .net-3.5 visual-studio-2008

我正在尝试使用VS2008 SP1和x64 XP运行NAnt 0.86b1.

我有一个基本的构建文件(下面)给出错误不支持文件'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>
Run Code Online (Sandbox Code Playgroud)

还有其他人遇到过这个问题吗?我找不到任何有用的东西.

Mat*_*ell 8

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

我建议使用nantcontrib <msbuild>任务来处理比VS2003更新的所有项目.

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


小智 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>
Run Code Online (Sandbox Code Playgroud)