2009-08-19 125 views
1

我覆蓋了我的TFS構建文件中的以下目標,以運行在Visual Studio 2008中設置數據庫,導入數據等的各種任務 - 目標是僅停止網站與服務器,而不是整個機器上停止整個W3SVC服務上的應用程序池關聯(參見例如備用任務):AppController錯誤:索引超出範圍

<Target Name="AfterCompile"> 

    <AppPoolController ApplicationPoolName="$(AppPoolName)" Action="Stop" ServerName="$(WebsiteMachine)" /> 

    <!--<MSBuild.ExtensionPack.Computer.WindowsService TaskAction="Stop" MachineName="$(WebsiteMachine)" ServiceName="W3SVC"/>--> 


    <!-- various tasks and what not, which have been confirmed to work fine with the option of stopping the W3SVC --> 

    <AppPoolController ApplicationPoolName="$(AppPoolName)" Action="Start" ServerName="$(WebsiteMachine)" /> 
</Target> 

然而,當我嘗試編譯,我得到以下幾點:

$(BuildDirectoryPath)\BuildType\TFSBuild.proj(81,5): error : Index was outside the bounds of the array. 

上面提到的各種任務只是:任務,調用其他目標等。那麼錯誤的來源在哪裏?我已閱讀MSBuild社區任務文檔,但最接近類似數組的任何東西都是Action屬性上的Enum。看起來,其他人在使用XML的不同應用程序中遇到同樣的錯誤,但到目前爲止,我還沒有找到任何啓​​發。我也試過this,但無濟於事,除非我錯過了一些東西(這很可能)。

回答

0

錯誤可能來自任務中代碼拋出的異常。索引越界可以通過字符串索引屬性拋出,也許AppPool名稱沒有正確傳入。

查看任務的來源並檢查數組或屬性索引。

或者,您可以使用Exec任務將其解壓到iisapp.vbs

+0

原來我使用的是社區任務的過期版本。我沒有得到測試與修復的最新版本,因爲我不負責生成機器,不能安裝在服務器上的隨機東西:) – 2009-09-01 23:31:19