Nant脚本无法生成msbuild

Nant脚本无法生成msbuild,msbuild,nant,Msbuild,Nant,我被要求将VB.NET解决方案从Windows Server 2003、Visual Studio 2005、32位.NET 2.0迁移到Windows Server 2008、Visual Studio 2008、64位.NET 4.0。我已经在VisualStudio中编译了解决方案并运行良好。下一步是让Nant脚本工作,这样它将像以前一样进行签出、编译和测试 但是,当Nant脚本到达msbuild步骤时,它会立即失败,“…Microsoft.NET/Framework64/v4.0.303

我被要求将VB.NET解决方案从Windows Server 2003、Visual Studio 2005、32位.NET 2.0迁移到Windows Server 2008、Visual Studio 2008、64位.NET 4.0。我已经在VisualStudio中编译了解决方案并运行良好。下一步是让Nant脚本工作,这样它将像以前一样进行签出、编译和测试

但是,当Nant脚本到达msbuild步骤时,它会立即失败,“…Microsoft.NET/Framework64/v4.0.30319/msbuild启动失败。访问被拒绝”

我已经尝试使用相同的输入直接运行msbuild,但它已经超过了这一点。我的问题是:我是否可以在我的nant.build中添加一些东西,让它以管理员的身份运行它的任务

我的.build文件:

<?xml version="1.0"?>
...
<credential domain="xxxx" username="xxxxx" password="xxxxxx" id="55" />
<property name="debug" value="true" overwrite="false" />
<property name="configuration" value="debug" overwrite="false" />
<property name="solution.file" value="solution.sln" overwrite="false" />
...
<target name="msbuild" description="Build the whole solution">
<exec program="C:/Windows/Microsoft.NET/Framework64/v4.0.30319/msbuild" workingdir="D:/BuildTest" commandline='"${solution.file}" /v:q /nologo /p:Configuration=${configuration}' />
</target>
...

...
...
...

我在32位机器上也有同样的问题。我的一个变通方法是使用nantcontrib的msbuild任务。有人知道这是为什么吗

在64位计算机上,exec方法也可以工作。我必须指向正确框架文件夹中的msbuild.exe

<target name="compile" description="Compiles the .Net solution">

    <!-- this works -->
    <msbuild project="${src.root.dir}\${src.solution}"
                     verbosity="Normal">
        <arg value="/p:Configuration=${msbuild.configuration}" />
        <arg value="/p:Platform=Any CPU" />
        <arg value="/t:Rebuild" />
        <arg value="/nologo" />
    </msbuild>

    <!-- access is denied -->
    <exec program="${msbuild.path}"
          workingdir="${src.root.dir}" 
          basedir="${src.root.dir}"
          commandline="${src.root.dir}\${src.solution}${src.solution}"
          failonerror="true" >
        <arg value="/p:Platform=Any CPU" />
        <arg value="/p:Configuration=${msbuild.configuration}" />
        <arg value="/t:Rebuild" />
        <arg value="/v:${msbuild.verbosity}" />
    </exec>
</target>

如果msbuild行

<exec program="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe">

此解决方案在应用于ProcessStartInfo时也有效。谢谢