gpt4 book ai didi

msbuild - Nant 脚本无法生成 msbuild

转载 作者:行者123 更新时间:2023-12-04 06:09:11 25 4
gpt4 key购买 nike

我被要求将 VB.NET 解决方案从 Windows Server 2003、Visual Studio 2005、32 位、.NET 2.0 迁移到 Windows Server 2008、Visual Studio 2008、64 位、.NET 4.0。我有在 Visual Studio 中编译和工作正常的解决方案。下一步是让 Nant 脚本工作,这样它就会像以前一样 check out 、编译和测试。

但是,当 Nant 脚本进入 msbuild 步骤时,它会立即失败并显示“...Microsoft.NET/Framework64/v4.0.30319/msbuild failed to start. Access is denied”

我已经尝试使用相同的输入直接运行 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 - Nant 脚本无法生成 msbuild,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7988281/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com