I have an MSBuild script that deploys a web application. It stops the current web application by copying the file "app_offline.htm" to the server. After that, it deletes the other files and then copies them to the server.
I need to add a delay between copying "app_offline.htm" and deleting.
My current script throws errors because the files are still locked when the script tries to delete them.
What is the best way to do this in MSBuild?
My stop task looks like this:
<Target Name="Stop">
<WriteLinesToFile File="$(DeployDirectory)\app_offline.htm" Lines="Offline for maintenance" Overwrite="true" Encoding="Unicode"/>
</Target>
My uninstall task looks like this:
<Target Name="Clean">
<ItemGroup>
<Files Include="$(DeployDirectory)\**\*" Exclude="$(DeployDirectory)\app_offline.htm" />
<Files Include="$(LogDirectory)\*" />
</ItemGroup>
<Delete Files="@(Files)" />
</Target>
source
share