Tarun and I, developed Tag Admin extension for Visual Studio around 2 years back. Over a period of time, we got busy and the extension has developed few bugs, mostly because there were few changes in the REST API and we could not update the extension accordingly.

However, now that Visual Studio 2017 is out, it was time to update the extension and make it compatible with Visual Studio 2017 and also fix the bugs :-).

Tag Admin for Visual Studio 2017

Download the extension from Visual Studio Marketplace. If you are keen to try out ‘under development’ bits, please download the VSIX directly from CI build

Upgrade process

The whole upgrade process was easy. Visual Studio 2017 is super light weight and has a new VSIX extension manifest format (VSIX3). There is also a step-by-step guide on how to migrate extensions to Visual Studio 2017.

I just had to follow the guide and my extension was ready to be used with Visual Studio 2017.

Fixing existing bugs in the extension

Our Visual Studio 2013 and 2015 extensions used the REST API and we used to construct the URL’s required as per the API.

For Visual Studio 2017 extension though, I decided to use the new REST based HTTP client which made development easy. You no longer required to construct the URL’s. Most of the REST calls happens behind the scene.

Take for example the below code snippet to Get the Tags.

Old code with REST URL

var restRequest = includeInActive ? string.Format("_apis/tagging/scopes/{0}/tags?includeInactive=true", Scope) : string.Format("_apis/tagging/scopes/{0}/tags", Scope);
var request = new HttpRequestMessage();
AddReqestHeaders(request);
request.Method = HttpMethod.Get;
request.RequestUri = _baseUrl.AddRestParameter(restRequest);
var response = await SendAsync(request);
tagResponse.Data = JsonConvert.DeserializeObject<T>(response.Content.ReadAsStringAsync().Result);
return tagResponse.Data;

New code with REST HTTP client

var tagClient = await GetTagClient();
var tags = await tagClient.GetTagsAsync(Scope);
return tags;

As you can see, the code is simple and also readable. So converting existing code to use new REST HTTP client went super smooth and it was easier that I expected.

Download

So, please go ahead and try out the new version and let me know if you have any feedback.

Related Posts

About Utkarsh Shigihalli

Utkarsh is passionate about software development and has more than 10 years of work experience. He has developed numerous extensions for Visual Studio and Visual Studio Team Services. He is currently working as DevOps lead in one of the leading insurance company in United Kingdom