Note that there are some explanatory texts on larger screens.

plurals
  1. PODeleting app_offline during TFS 2010 build
    primarykey
    data
    text
    <p>I have a custom TFS Build process for my Web Application Project, which also does a publish. To accomplish this I attempt to delete the current publish location before copying over the compiled sources from the build. </p> <p>This works (most of the time) except when files are locked because there are people accessing the site, generally not a problem since most of the time the builds happen when no-one is access them (as these are purely development and QA builds).</p> <p>To try and fix those edge cases where the publish directory can't be deleted, I copy an app_offline.htm file to the directory and wait 4 seconds before trying to delete the rest of the site. This works and I haven't gotten any errors from this step however, when I try to delete the app_offline.htm after the publish is finished. I get the following error:</p> <blockquote> <p>Cannot cancel the workflow. Agent needs to be restarted. Details: The operation could not be performed because WorkflowApplication f670d4fb-d9e3-4f33-bc3d-925faa925e04 is aborted.</p> </blockquote> <p>The delete is created using a custom CodeActivity (since TFS Workflow doesn't have a delete).</p> <pre><code>public sealed class DeleteFile : CodeActivity { // Define an activity input argument of type string [RequiredArgument] public InArgument&lt;string&gt; File { get; set; } public InArgument&lt;int?&gt; Tries { get; set; } // If your activity returns a value, derive from CodeActivity&lt;TResult&gt; // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument int tries = Tries.Get(context) ?? 1; for (int i = 0; i &lt; tries; i++) { try { System.IO.File.Delete(File.Get(context)); break; } catch (System.IO.IOException) { if (i == tries - 1) throw; Thread.Sleep(TimeSpan.FromSeconds(4)); } } } } </code></pre> <p>I added the "Tries" argument later to try and catch what was causing this error.</p> <p>However, of note, when viewing the log, the error above is not placed under the DeleteFile activity, but only at the top of the log and there are no other errors or warnings.</p> <p>Lastly, our tfsbuild user has delete permissions on the publish directory (it has no issues deleting the rest of the directory just app_offline.htm</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload