代码之家  ›  专栏  ›  技术社区  ›  ilivewithian

Nant拒绝使用.Net 3.5

  •  0
  • ilivewithian  · 技术社区  · 14 年前

    <?xml version="1.0"?>
    <project name="IPSA System" default="build" basedir=".">
      <property name="nant.settings.currentframework" value="net-3.5"/>
      <msbuild project="FS.IPSA.WebAdmin\FS.IPSA.WebAdmin.csproj">
        <arg value="/property:TeamOutPath=Release\FS.IPSA.WebAdmin" />
        <property name="TeamOutPath" value="Release\FS.IPSA.WebAdmin" />
      </msbuild>
    </project>
    

    nant.settings.currentframework 脚本中的值应该强制框架版本。事实似乎并非如此。还有什么可能导致这个问题?

    2 回复  |  直到 14 年前
        1
  •  1
  •   Martin Vobr    14 年前

    可能msbuild任务无法生成vs.net 2008解决方案(例如错误版本的msbuild.exe 称为)。

    用这样的东西怎么样:

        <!-- msbuild from .net 2.0 is unable to build vs.net 2008 solutions. Let's try to find .net 3.5 version of msbuild -->      
        <property name ="msbuild.exe" value="msbuild"/> <!-- default-->
        <property name="windows.dir" value="${environment::get-variable('windir')}"/>
        <property name="net3.5.dir" value="${windows.dir}/Microsoft.NET/Framework/v3.5"/>
        <if test="${directory::exists(net3.5.dir)}">
            <property name="msbuild.exe" value="${net3.5.dir}/msbuild.exe"/>
        </if>
    
        <!-- current nant msbuild task is unable to build VS.NET 2008 solutions -->
        <!-- let's try run correct msbuild.exe via the exec task -->
        <exec program ="${msbuild.exe}" verbose="true">
            <arg value="/property:TeamOutPath=Release\FS.IPSA.WebAdmin" />
            <arg value="FS.IPSA.WebAdmin\FS.IPSA.WebAdmin.csproj"/>
        </exec>
    
        2
  •  0
  •   ilivewithian    14 年前

    最后发现nant并没有引起问题,而是调用了正确版本的msbuild,但是msbuild调用了错误版本的csc.exe. 我还没找到它为什么这么做,但看起来是msbuild,不是nant。