I overrode the following target in my TFS build file to run various tasks that set up databases, import data, etc., etc. in Visual Studio 2008 - the aim was to stop only the website associated with an application pool on the server instead of stopping the entire W3SVC service on the entire machine (see alternate task for example):
<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>
However, when I try a build, I get the following:
$(BuildDirectoryPath)\BuildType\TFSBuild.proj(81,5): error : Index was outside the bounds of the array.
The various tasks mentioned above are just that: tasks, calls to other targets, etc. So where is the source of the error? I have read the MSBuild Community Tasks documentation, but the closest thing to anything resembling an array is an Enum on the Action property. It seems that other people get the same error with different applications using XML, but so far I haven't been able to find anything enlightening. I have also tried going off this, but to no avail, unless I missed something (which is very possible).