2012-02-03 77 views
0

當我們使用msbuild.exe從命令行構建Visual Studio 2010數據庫項目時,它有時可能會從同一命令行運行兩次。MSBuild .dbproj似乎運行兩次

我們從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=&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). 

誰能幫助,爲什麼目標好像是叫兩次(只是有時 - 我還沒有想通了,爲什麼只是偶爾)。該腳本始終運行在一個空的文件夾結構中,因此從前一次運行構建中不會留下構建輸出。

回答

0

首先嚐試的輸出詳細程度改變診斷爲的MSBuild:

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

與同爲Ant腳本。我沒有使用Ant的經驗,但你會知道如何去做;) 希望你會在診斷日誌中找到一個原因...

這個命令行選項重複MSBuild。從以下中刪除一個精氨酸:

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

/v是縮寫/冗長see MSDN爲MSBuild的命令行選項參考。

+0

非常感謝,增加了額外的詳細程度揭示了原因 – 2012-02-07 12:48:39