I have created a build extension and first time I tried to upload it I got an error because the json file wasn't well formatted. After fixing and trying again I get the error The extension already exists but the extension is not shown in the tfs extension list. How can I remove the extension from tsf database or from tfs cache server? Is there any specific location on server? I even cleared my local cache but didn't help.
Just try to clean the client caches (including both TFS and Browser), then try it again.
TFS: C:\Users\{your account}\AppData\Local\Microsoft\TeamFoundation\{version}\Cache
Browser, IE for example (based on your settings) :
C:\Users\{your account}\AppData\Local\Microsoft\Windows\INetCache
If that still not work, just try below things:
Delete the existing extension with the REST API: (On success the server will return 204 Not Content
.)
Delete http://server:8080/tfs/_apis/gallery/publishers/{publisher}/extensions/{extensionId}
(You can get the publisher
and extensionId
from the vss-extension.json file.)
Just use the tools such as Postman to send the Delete request, or you can use below PowerShell script to delete the existing extension:
Param(
[string]$tfsurl = "http://server:8080/tfs",
[string]$publisher = "Andy",
[string]$extensionId = "sample-extension",
[string]$user = "username",
[string]$token = "password"
)
# Base64-encodes the Personal Access Token (PAT) appropriately
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))
$baseUrl = "$tfsurl/_apis/gallery/publishers/$publisher/extensions/$($extensionId)?api-version=3.2-preview.2"
$response = (Invoke-RestMethod -Uri $baseUrl -Method Delete -ContentType "application/json" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)})
Another workaround is changing the extension ID for the fixed extension and package it again, then upload it.