Automating the removal of TDS Projects

As part of the recent work I’ve done on migrating from TDS to SCS I had some tidying up to do. I needed to remove the TDS projects from the solution and all the files and sub-folders, including the .item files.

We had around 66 TDS projects in the Solution so this wasn’t something I wanted to do manually as It would take a while and I’d likely missing something. I figured someone must have written a script to do this but I couldn’t find anything. So I created a PowerShell Script myself to do this.

Note 1: There is a dependency here on the dotnet cli. This was the most efficient and supported way of cleaning up the solution file and most developers will likely have this installed already.

Note 2: I setup SCS to create my serialized items in an folder called scs. This was so all the legacy TDS items could stay in the serialization folder instead to separate them. If you’ve not done this you may need to modify the script below for your needs to re-configure the SCS folder before using my script.

If you save the script to your machine from the Gist below it will look something like this:

Show me the Script Already

When you open the script you need to set the variables for your Solution path, Solution name and if projects, files, folders and parent folders should be removed.
Most of these should be set to $true but depending on your folder structure you might need to set $tidyUpParentFolders to $false:

After the script has run you will see an output showing what the script has removed, including project files, item files and folders:

One you’ve run it check the removed files look correct before checking in your changes to source control. Also ensure your solution still builds and there are no issues.

Hopefully this is useful for anyone else who makes the move to TDS from SCS.

For more on Migrating from TDS to SCS read: A Guide to Migrating from Sitecore TDS to SCS

Published by

Adam Seabridge

I am a Freelance Sitecore Developer and 7x Sitecore Technology MVP (2024 - 2018). I have been working with Sitecore since 2013. You can reach me on twitter @billyjava or comment below if you have any questions or feedback.

Leave a Reply

Your email address will not be published. Required fields are marked *