当我们使用msbuild.exe从命令行构建Visual Studio2010数据库项目时,它有时可以从同一命令行运行两次。
我们从nAnt脚本调用msbuild,然后调用'Build‘目标。我们的数据库项目相当大,因此可能需要大约4分钟才能运行完一次。当它运行两次时,我们的数据库构建需要超过8分钟。
下面是我们用来调用构建的exec部分。它在只有一个.dbproj的.sln文件上运行。
<exec program="${framework::get-tool-path('msbuild.exe')}" append="true" failonerror="true" verbose="true">
<arg value="${database.sln}" />
<arg value="/p:OutputPath=${build.output.database}" />
<arg value="/nologo" />
<arg value="/t:Build" />
<arg value="/p:Configuration=Release" />
<arg value="/p:WorkingDir="."" />
<arg value="/verbosity:normal" />
<arg value="/v:m" />
</exec>我们得到的输出如下所示
Creating a model to represent the project...
Loading project references...
Loading project files...
Building the project model and resolving object interdependencies...
Validating the project model...
(x) problems have been detected.
[a list of warnings based on the db analysis]
The results are saved in (y).
Creating a model to represent the project...
Loading project references...
Loading project files...
Building the project model and resolving object interdependencies...
Validating the project model...
(x) problems have been detected.
[a list of warnings based on the db analysis]
The results are saved in (y).有没有人可以帮助解释为什么这个目标似乎被调用了两次(只是有时候--我还不知道为什么,只是有时候)。该脚本始终在空文件夹结构上运行,因此不会有前一次运行构建留下的构建输出。
发布于 2012-02-03 18:27:08
首先,尝试将输出详细信息更改为MSBuild的诊断:
<arg value="/v:diag" />Ant脚本也是如此。我没有使用Ant的经验,但您应该知道如何操作;)希望您能在诊断日志中找到原因……
顺便说一句:你有重复的MSBuild命令行选项。从以下内容中删除一个参数:
<arg value="/verbosity:normal" />
<arg value="/v:m" />/v是/verbosity see MSDN的缩写,用于MSBuild命令行选项参考。
https://stackoverflow.com/questions/9126026
复制相似问题