0
votes

I have folders within both Azures VSTS (a TFVC repository) and TFS that I needed to permanently delete. On TFS this was quite easily done using the tf destroy $/<MyProject>/<Folder_To_Delete> command in a command window on the server on which the TFS is running. The web page in docs.microsoft.com that describes the "tf destroy" command (Https:// docs.microsoft.com/en-us/vsts/tfvc/destroy-command-team-foundation-version-control) shows that this command is also available for VSTS however I have been unable to get the command to work within a Developer Command Prompt window running on my local box.

tf destroy $/<MyProject>/<Folder_To_Delete> /collection:https://<MyTeamService>.visualstudio.com/<MyProject> /login:<userid>,<password>

The error I receive back is

TF31002: Unable to connect to this Team Foundation Server:

Team Foundation Server Url:

Possible reasons for failure include:

- The name, port number, or protocol for the Team Foundation Server is incorrect.

- The Team Foundation Server is offline.

- The password has expired or is incorrect.

Technical information (for administrator):

The remote server returned an error: (404) Not Found.

However if I put the URL into a browser my VSTS instance shows up. So the 404 looks to me like azure is blocking outside efforts to permanently delete on VSTS. I have logged onto the Azure portal expecting to find something like the Advanced tools option you would find on Web App Services, But the Team Services / Team Projects has nothing like this. Can someone explain to me how to properly execute the "tf destroy" command on Azure Team Services? Or does Azures VSTS just lack the support to permanently delete individual folders and files?

3

3 Answers

1
votes

The tf destroy command requires a collection URL. In VSTS, there is no concept of a collection, only team projects. All team projects are created under the Default Collection.

To use the tf destroy command with VSTS, your collection URL must be in the following format: https://accountname.visualstudio.com/DefaultCollection

By putting a collection URL of https://accountname.visualstudio.com/Project Name, the command was looking for a collection called Project Name in the VSTS account, which does not exist.

This command works: Open a Developer Command Prompt in administrator mode and issue the following command and supply your credentials. tf destroy $/Project Name/Folder To Delete /collection:https://accountname.visualstudio.com/DefaultCollection

1
votes

To Permanently destroy an item/folder in VSTS is also using Destroy Command (Team Foundation Version Control)

tf destroy [/keephistory] <itemspec1>[;<versionspec>][<itemspec2>...<itemspecN>] 
[/stopat:<versionspec>] [/preview] [/startcleanup] [/noprompt] [/silent] [/login:username,[password]] [/collection:TeamProjectCollectionUrl]]

/collection which specifies the team project collection. However, in VSTS you only have one collection. There is no collection name like TFS in the url. And multiple collections under user voice:

Let us create multiple collections on Visual Studio Team Services

https://developercommunity.visualstudio.com/idea/365419/let-us-create-multiple-collections-on-visual-studi.html

So, when you specify /collection for VSTS in tf command line, you just need to enter https://xxx.visualstudio.com

Also pay attention to the /login:<userid>,<password>, you are using the wrong format, it should be /login:userid,[password], add a /preview for test first(When tf destroy runs in the preview mode, the files are not actually destroyed.)

Finally the result will be

enter image description here

When you remove the /preview and perform the really destroy, you will also get a prompt info:

Do you want to destroy $/Scrum/NugetTest/Capture1025.PNG and all of its children? (Yes/No/All)

Select Yes to delete folder and files in it, All with all of its children.

0
votes

https://<MyTeamService>.visualstudio.com/<MyProject> is the wrong URL. It should just be https://<MyTeamService>.visualstudio.com/.

The parameter is asking for a project collection, not a team project within the collection.