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.
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.
Sign up to join this communityGiven 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.
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.
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.