Introduction
This article is the continuation of “Creating your first visual studio VSIX package” article of the series Visual Studio Extensibility. The first part focused on creating a Visual Studio extension to locate a file or folder in Windows Explorer. This article will illustrate how to make your Visual Studio extension deployment ready, i.e. how to deploy the extension to Staging Server via GIT and publish the extension on Visual Studio market place to make it available to the public.
In this article I’ll explain how one can directly check in the Visual Studio extension to the GIT repository, and as soon as the extension is pushed to GIT repository, it automatically deploys to a staging server made on AppVeyor via Continuous Integration and compiles the code there and then automatically updates the same extension to the production that is, in our case, Visual Studio Gallery.
Roadmap
Let me again revise the roadmap of this series of Visual Studio Extensibility. The series will be divided into three articles as mentioned below, and we’ll focus more on practical implementations and hands-on rather than going much into theory.
- Visual Studio Extensibility (Day 1): Creating your first visual studio VSIX package
- Visual Studio Extensibility (Day 2): Deploying the VSIX package on staging server and GIT via Continuous Integration
- Visual Studio Extensibility - Visual Studio Extension In Visual Studio Isolated Shell - Day Three
Prerequisites
The prerequisites for this article are a running application that was created in the prior part of the series or a running sample visual studio extension application. You will also need to have an account on Github . So please create one.
Before we actually start, I need the readers of this article to download install Extensibility tools written by Mads Kristensen from https://marketplace.visualstudio.com/items?itemName=MadsKristensen.ExtensibilityTools.

This article series is highly inspired by Mads Kristensen’s speech at Build 2016 and his work on Visual Studio extensibility.
Publish extension on GIT
Open the existing source code for file locater in Visual Studio. Right click the solution and you’ll see Extensibility Tools option, and in its context menu, an option to “Prepare for Github…”. Select that option, as shown in the following image.

This will ask a confirmation that certain files in context of GIT would be added to the solution, click Yes and proceed.

When you click "Yes", a Readme file and a changelog file will be added to the solution as shown below, and a lot of other files will be added to the folder on the file system where your code exists.
If you see the Readme file, you’ll see that it is smart enough to pick the information from the manifest file and add the same description “Helps to locate files and folder in windows explorer” inside it.

ChangeLog file is also very important as it provides the update to the users of what is the roadmap of your project, what were the features in the last release and what features are yet to come in the near future. It also keeps track of version number information. The changelog also helps you to create a kind of document for yourself along with details of your project/extension.

Let’s update the ChangeLog file to make it more descriptive w.r.t. our extension.

We call it version no. 1.0 and the date of release, and since it is an Initial release, provide the text saying it is an initial release and the feature; i.e., open the file in windows explorer. And on the roadmap, since we do not have anything planned yet, you can specify Coming Soon… as shown in the last image.
When we prepared the solution for Github, a license was also added to the project folder, so now we have the license and we can add the license to our extension. Open the source.extension.vsixmanifest, there we can see the license option.

Browse for the license file located at the location where other GIT files were added, choose the license file and add it as a link as shown in the following image.

Now right click the added license file in Resources folder in Visual Studio and open its properties, change the Build Action to Content and Include in VSIX option to true, so that our license is embedded and shipped with the vsix extension itself.

Now the extension users can see the license when they install the extension.
We also now need to update the Readme file, as it will be available in visual studio gallery and the users will get help from this file on what it actually does and how to use it. So we need to update the readme file with some description and clear screen shots that help users to understand the extension better.
Add the text in the Features section to describe the extension like “Open the selected file in windows explorer”. Feature 1 as “Locate files in windows explorer”, and give it some descriptive text like “select the file or multiple files and right click” as shown in the below image.

Now add an image at the location below Feature 1,

This will open the folder where you want to save the image, just create a new folder named images, to the location where your source code is and place the image there, it will automatically be added to the Readme.md with the image link as shown in above image of Readme file. Similarly add the second that shows the opened folder and add some description to the Readme file.
Now the solution is ready to be pushed to GIT. Right click solution, and in the context menu, choose the option of “Add Solution to Source Control” as shown below.

When you click on this option, a dialog will be shown to choose the option for source control.

Choose Git and click OK. You’ll be asked to Configure your user name and email address before you commit to the change.

Provide your Git account credentials at this place.

If you do not have the GitHub extension , download it from extensions and updates as shown below

Install it and now the solution is ready to be committed.

Give your repository a name and publish it to Github. Your source code will be pushed to Github and a repository will be created with the same name as you specified while publishing.

Now click on your repository, and you can see the complete source code available on Git, with the read me information that we supplied to the extension.

Continuous Integration build via Appveyor
Now what we want is that as soon as the source code gets published on Git, it should be compiled automatically and be published to visual studio gallery of extensions. For that we’ll use Appveyor. Right click the solution, in the context menu under Extensibility Tools; choose the option to “Prepare for Appveyor”.

This option will ask you to add Appveyor.yml, click OK and it will be added to your solution as shown in the following image. This yml file is the build script that is added to the solution.

Commit and push again the changes to Git.










































Join the conversation! Your thoughts help the community grow.