7

Given the answer in the question here is it possible to achieve deletions while still using TDS' delta package functionality?

I've previously used Sitecore Courier to do delta deploys but this relies on having both sets of serialised files.

  • Are TDS Delta packages a requirement here? Using Unicorn this is a simple task. – Richard Seal Oct 25 '16 at 13:12
  • This is an issue with TDS regardless of delta or not, correct? Since according to your other question, you can't use child sync? TDS doesn't have any system built in to track items that were in the project previously, but are not anymore. – nickwesselman Oct 25 '16 at 13:55
  • @RichardSeal can't use Unicorn as TDS is too ingrained already. – Jason Bert Nov 3 '16 at 8:56
  • @techphoria414 I understand TDS doesn't support this, hence stating it in the question. I'm looking for alternatives while still retaining TDS. I'm not expecting an easy answer either :) – Jason Bert Nov 3 '16 at 8:57
  • @JasonBert yep I was just clarifying that it's an issue with TDS whether or not you are doing delta deploys. – nickwesselman Nov 3 '16 at 9:58
4

As noted elsewhere, this is a limitation of TDS in general, since it has no knowledge of the deleted item once it is no longer in the scproj (TDS Project).

One option would be to place your items into an isolated folder so that you can use Deployment Properties / Recursive Deployment Action to sync children of that folder.

If that's not an option for you, you'll need another deployment step that can actually examine your source history or a previous version of the package to determine removed items, and delete them.

| improve this answer | |
3

As mentioned in the answer from @techphoria414, the simplest solution is structuring your items in isolated folders and setting the sync settings as well as set the Recursive Deploy Action in the Build Tab to either Delete Sitecore Items not in the Project or Move Sitecore Items not in the project to the Sitecore Recycle Bin.

However, if you want to remove a parent folder or you cannot create a custom folder, the items will remain after deployment of the update package. One option is to create a custom Post Deploy Step. You would need to manually manage the list of items that should be deleted though.

If you are also using Sitecore PowerShell Extensions then you can combine this with a custom Post Deploy step that will run any number of SPE scripts. You can use a script item to delete any items you want:

$items = @(
    "master:/{12345678-1234-1234-1234-123456789012}", 
    "master:/sitecore/path/to/item",
    "core:/sitecore/path/to/another/item"
)

Foreach ($item in $items)
{
    if (Test-Path -Path $item) {
        Write-Log "[TDSPostDeploy::SPE] Deleting item - $item"
        Remove-Item -Path $item
    } else {
        Write-Log "[TDSPostDeploy::SPE] Item does not exist - $item" -Log Warning
    }
}

Since the scripts are added like any normal Sitecore Item, they can be added to TDS and then removed once they are no longer needed.

You can find more details in this blog post about TDS Post-Deploy PowerShell Step. Alternatively, you can create a similar step in C# if you do not have access to SPE, and the items passed in as parameters and the scproj file can be sourced controlled.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.