Friday, July 24, 2009
TFS - Stop and Start Server
After some failed attempts at stopping and starting servers through third party tasks, I had quick success using the exec command in the TFSBuild.proj:
<PropertyGroup>
<web-site-id>1</web-site-id>
<server-cmd-prefix>C:\Windows\system32\cscript.exe c:\Inetpub\AdminScripts\adsutil.vbs</server-cmd-prefix>
<stop-server-cmd-line>$(server-cmd-prefix) STOP_SERVER W3SVC/$(web-site-id)</stop-server-cmd-line>
<start-server-cmd-line>$(server-cmd-prefix) START_SERVER W3SVC/$(web-site-id)</start-server-cmd-line>
</PropertyGroup>
<Target Name="StopSite">
<Message Text="stopping site..."/>
<Exec Command="$(stop-server-cmd-line)"/>
</Target>
<Target Name="StartSite">
<Message Text="starting site..."/>
<Exec Command="$(start-server-cmd-line)"/>
</Target>
To find the web-site-id, refer to Scott Forsyth's Blog.
Subscribe to Posts [Atom]