问题
Using Developer Command Prompt for VS 2019
I am able to see a list of all my workspaces.
tf workspaces /collection:"https://dev.azure.com/[ORGANIZATION]" /owner:*
I can then delete my local workspaces using:
tf workspace /delete [WORKSPACE];"[OWNER]"
If I launch Visual Studio and then rerun first command the workspace returns.
The same thing occurs if I delete the workspace from the VS UI. It will reappear as soon as I click map & get
to create a new workspace of same name just deleted.
NOTES
Prior to relaunching Visual Studio I also tried:
- Clearing the cache folder here:
C:\Users\[NAME]\AppData\Local\Microsoft\Team Foundation\8.0\Cache
- Deleting all my local workspace files here:
C:\Users\[NAME]\source\Workspaces
EDIT
After some testing I believe the issue may relate to an old workspace that had the same name. I cannot delete the old workspace because when I try to delete old non local databases I receive:
ERROR:
The workspace [WORKSPACE];[OWNER] does not exist.
I now believe the old workspace is a trace from when I migrated to Azure from old TFS.
QUESTIONS
- How can I delete ALL workspaces?
- Can workspaces be deleted from the Azure Dev Ops portal?
- How can you delete non local workspaces?
回答1:
To delete an existing workspace, you must be the owner or have the global Administer workspaces permission set to Allow.
You could also try to use onwer uniq ID instead of name
tf vc workspaces ws_3_3 /computer:* /format:xml /collection:https://dev.azure.com/patricklu/
ws_3_3
is your workspace name which want to delete, collection just type your collection url
In the prompt up window type your address to connect to the url(If there is).
After this it will return some information such as below:
With info of owner uniq ID
Then you just need to use tf workspace /delete the command, in my sample it’s using:
tf workspace /delete ws_3_3;fb46f066-9122-4342-94c4-93b7526a3545
Simply type yes, it will delete the workspace. "Unable to determine the source control server" This may caused by you didn't include the collection url when you try to delete a workspace not locally.
1. How can I delete ALL workspaces?
There is not a command to delete all workspaces in company, you have to do it one by one.
2. Can workspaces be deleted from the Azure Dev Ops portal?
No, you couldn't do this. You should either use command line or through Visual Studio UI as below:
Hope this helps.
来源:https://stackoverflow.com/questions/57758543/azure-devops-deleting-workspace