MSBuild a .dbproj 似乎运行了两次

发布于 2025-01-02 06:44:20 字数 1510 浏览 0 评论 0原文

当我们使用 msbuild.exe 从命令行构建 Visual Studio 2010 数据库项目时,它有时可以从同一命令行运行两次。

我们从 nAnt 脚本调用 msbuild,然后只调用“Build”目标。我们的数据库项目相当大,因此运行一次大约需要 4 分钟。当它运行两次时,我们的数据库构建需要超过 8 分钟。

这是我们用来调用构建的 exec 部分。它在一个 .sln 文件上运行,该文件中只有一个 .dbproj。

<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=&quot;.&quot;" />
    <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).

任何人都可以帮忙解释为什么目标似乎被调用两次(只是有时 - 我还没弄清楚为什么只是有时)。该脚本始终在空文件夹结构上运行,因此以前运行的构建不会留下任何构建输出。

When we build our Visual Studio 2010 Database Project from the command line using msbuild.exe it can sometimes run twice from the same command line.

We call msbuild from a nAnt script, and just call the 'Build' target. Our database project is quite large so it can take about 4 mins to run through a single time. When it runs through twice our database build takes over 8 minutes.

Here is the exec section we use to call the build. It runs on a .sln file that only has a single .dbproj in it.

<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>

The output we get looks like

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).

Can anyone help as to why the target seems to be called twice (only sometimes - I haven't figured out why only sometimes). The script always runs on an empty folder structure so there is never a build output left over from a previous run of the build.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绮筵 2025-01-09 06:44:20

首先尝试将 MSBuild 的输出详细程度更改为诊断:

<arg value="/v:diag" />

对于 Ant 脚本也是如此。我没有使用 Ant 的经验,但你应该知道怎么做;)
希望您能在诊断日志中找到原因...

顺便说一句:
您有重复的 MSBuild 命令行选项。从以下内容中删除一个参数:

<arg value="/verbosity:normal" />
<arg value="/v:m" />

/v 是 /verbosity 的缩写请参阅 MSDN MSBuild 命令行选项参考。

First of all try to change the output verbosity to diagnostic for MSBuild:

<arg value="/v:diag" />

And the same for the Ant script. I don't have experience with Ant , but you shpould know how to do it ;)
Hopefully you will find a reason in the diagnostic logs...

BTW:
You have duplicate command line options for MSBuild. Remove one arg from the following:

<arg value="/verbosity:normal" />
<arg value="/v:m" />

/v is abbreviation for /verbosity see MSDN for MSBuild command line options reference.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文