Click here to Skip to main content
15,867,330 members
Articles / Programming Languages / C#

Visual Studio Extensibility (Day 3): Visual Studio Extension in Visual Studio Isolated Shell

Rate me:
Please Sign up or sign in to vote.
5.00/5 (17 votes)
8 Mar 2017CPOL11 min read 20.4K   304   10   10
Customize basic Visual Studio Isolated shell application and add custom extension to the shell application.
In this three article series of Visual Studio Extensibility, we’ll learn how to create a new Visual Studio package, deploy that on staging server and GIT via continuous integration setup and at the end, create a Visual Studio isolated Shell application with that embedded package. In this third part, you will see how to customize the basic Visual Studio Isolated shell application and add a custom extension to the shell application.

Table of Contents

Introduction

This article is the continuation of the article "Creating your first Visual Studio VSIX package" in this series on Visual Studio Extensibility. The first part focused on creating a Visual Studio extension to locate a file or folder in Windows Explorer. The second part was more about deploying the Visual Studio extension to staging server via continuous integration. This article will illustrate how to add or embed the Visual Studio extension or Visual Studio package into a Visual Studio Isolated Shell application. Visual Studio provides the flexibility to create our own IDE or a Visual Studio kind of product altogether having custom extensions or some pre-defined functionalities of Visual Studio. Therefore, one can get their custom Visual Studio as a product which could be sold in the market.

In this article, I’ll explain how one can customize the basic Visual Studio Isolated shell application and add a custom extension to the shell application. Visual Studio can be completely customized from its launch screen to the advanced functionalities which it provides.

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.

  1. Visual Studio Extensibility (Day 1): Creating Your First Visual Studio VSIX Package
  2. Visual Studio Extensibility (Day 2): Deploying the VSIX Package on Staging Server and GIT via Continuous Integration
  3. Visual Studio Extensibility (Day 3): Embedding VSIX Package in Visual Studio Isolated Shell

Prerequisites

The prerequisite for this article is a running application that was created in Part 1 of this series. The source code for the prior application having a VSIX extension could be downloaded along with this article or from Github.

Visual Studio Shell

Visual Studio Shell has two modes, Integrated and Isolated. The following are the definitions for both the modes. One can read more on MSDN.

Integrated Mode

"Integrated mode enables your users to use standard Visual Studio features along with your custom tools. The integrated shell is intended primarily for hosting programming languages and software development tools.

Custom tools that are built on the integrated shell automatically merge with any other edition of Visual Studio that is installed on the same computer. You can provide a redistributable version of the Visual Studio integrated shell if Visual Studio is not already installed.

The redistributable version of the Visual Studio integrated shell does not include programming languages and the features that support their respective project systems."

Isolated Mode

"Isolated mode allows you to create custom tools that run side-by-side with other versions of Visual Studio. It is intended primarily for tools that can access Visual Studio services without depending on all the standard Visual Studio features. You can customize the appearance of applications built on the Visual Studio isolated shell. You can easily turn off the features and menu command groups that you do not wish to appear together with your application."

Visual Studio Isolated Shell

The definition from the MSDN says,

"The Visual Studio isolated shell allows you to create stand-alone applications that can run side-by-side with other versions of Visual Studio. It is used primarily to host specialized tools that can use Visual Studio services but also have a customized appearance and branding. Visual Studio features and menu command groups can be easily turned on and off. Application titles, application icons, and splash screens are fully customizable." Read more…

Like I described at the start of the article, you can use Visual Studio Isolated shell to create/customize Visual Studio like a product. There is a lot of theory around this which could be read in various places online like MSDN. This article will focus on creating a simple Visual Studio isolated shell application and integrating the pre-developed extension into it as the complete theory part is beyond the scope of this article.

Create Isolated Shell Application

Step 1 (Create New Project)

Open Visual Studio 2015, go to File->New->Project.

Image 1

Step 2 (Choose Isolated Shell)

In the installed project templates, expand the node for Other Project Types and choose Extensibility as project type. Choose Visual Studio Isolated Shell from the available templates under Extensibility and give the application a name. For example, ShellApplication as shown in the below image. Extensibility project types will only be available if you have extensibility features on while installing Visual Studio 2015, you can also modify Visual Studio installation to make these features available. This is explained in the first part of the series.

Image 2

Step 3 (Get the Solution)

When "OK" button is clicked, Visual Studio installs the necessary nugget packages and creates a solution with the same name as given earlier and this solution contains four projects. This is the basic structure of Isolated shell application and could be extended as per requirements. In the main editor screen, one can see the page containing all the information and link to good Visual Studio isolated shell articles on MSDN.

Image 3

Basic Isolated Shell Solution Structure

ShellApplication Project

This is the main project responsible for a customized appearance of isolated shell application. All the customizations and actions could be controlled from this project. This project contains the folder named ShellCustomization which allows how the application would look like, what should be the start / launch screen and what features we can enable or disable from the existing Visual Studio features. One can do this by customizing pkgdef or pkgundef file. Read more about customization.

Image 4

ShellApplication.AboutBoxPackage Project

This is a VSIX package project that helps us to customize Help\Aboutbox section. One can provide description, copyright information of the product here.

Image 5

Basically modify "About" section as per your need and desire.

ShellExtensionsVSIX Project

This is a small simple project containing a single file named "source.extension.vsixmanifest". This file holds a reference of various components and modules that are to be used in Isolated shell application. So whatever Visual Studio extensions or VSIX projects are added in isolated shell application, their reference is added in the shellextensionvsix project and specified in the Assets section of the file like Aboutbox package is specified in the following image:

Image 6

ShellApplicationUI Project

This is a C++ project that creates a satellite assembly having commands and resource strings that are localizable.

Customize Visual Studio Isolated Shell Application

Now we have the solution structure created and we can customize the application as per our need.

ShellApplication

In the ShellCustomization folder of the ShellApplication project, open the ShellApplication.Application.pkgdef file. We can see the available settings in the file in the form of key value pairs. SplashScreenBitmap setting as shown in the below image is used to define the default image file that shows up when the application is launched. The default is a white image with text at the bottom that says "Powered by Visual Studio." One can change this image as per the product’s main launch image. It takes path to Splash.bmp file in the root folder. Replace that Splash.bmp file with a custom image file. Since I’ll illustrate how to integrate search file extension, I have created a custom launch screen file with search image. Likewise, replace the ApplicationIcon and application small icon in the Resource Files folder, the settings of these are mentioned by the name AppIcon in the pkdef file. Change the AppName in the pkgdef file (for example, the name of your application/product). One can do more customizations by changing the values for the keys present in the pkgdef file as per our need like DefaultHomePage, DefaultSearchPage, etc.

Image 7

AboutBox Package

As mentioned earlier, one can also customize the AboutBox package responsible to show information in Help\About when the application launches. In the ShellApplication.AboutBoxPackage, open the source.extension.vsixmanifest file. Since this project is VSIX project type, one can see the vsct, extension and the command files in the project like earlier used in the find in explorer project created in the first part of this series. In the vsixmanifest file, specify the Author, version of the product, product name, description and language of the product in Metadata section. All this information will be shown when user clicks on Help\About button in Isolated shell application.

Image 8

Right-click vsixmanifest file and in the context menu, click on Auto-sync Resx and y=the Icon file to sync the resx file with the manifest file as shown in the following image. This step is also described in detail in the first part of the series.

Image 9

Now since we have synced the .resx and icon files, the redundant VSPackage.resx file makes no sense and can be deleted from the application as shown in the following image. We can see that the manifest file now has its own .resx file and .cs file underneath the source.extension.vsixmanifest file.

Image 10

Modify the assembly info of the AboutBoxPackage as per your need. The AssemblyInfo.cs file is located under Properties inside the ShellApplication.AboutBoxPackage project.

Image 11

Launch Visual Studio Isolated Shell Application

We are good to launch our basic Isolated shell application and see what we get. Compile the solution and press F5 to run the application. When the application starts, the custom image we used as Splash screen will be shown as below:

Image 12

After which the application launches. We see another Visual Studio kind of application with a custom small icon at the top and AppName that was specified in manifest file in ShellApplication pkgdef file.

Image 13

So, we get our custom application similar to that of Visual Studio.

Add VSIX Extension into Isolated Shell Application

One can add a new VSIX package as an extension or add an already developed extension inside the isolated shell application so that the extension becomes part of the product. We’ll add an already created LocateFolder extension to this isolated shell application. This requires a few simple steps.

Right-click on the solution explorer of Isolated shell application and choose an option to add an existing project. We need to add existing locate folder project to this solution.

Image 14

Once the project is added, the solution explorer will look as shown in the below image:

Image 15

Now we need to compile this project and add the reference to the ShellExtensionsVSIX project. Remember? This project contains a manifest file where all the extensions are mentioned.

Image 16

Right-click on References and add a reference to the LocateFolder project.

Image 17

Now open the source.extension.vsixmanifest file. In the Assets section, we can see an already specified AboutBox package.

Image 18

In a similar way, we need to add the LocateFolder project as well. So click on New button. A new window will be opened to add the new asset as shown below. Select the Type as Microsoft.VisualStudio.VsPackage, and Source as "A project in current solution" (because we have added the LocateFolder project as an existing project in our solution).

Image 19

Next, choose the project; in this case it is LocateFolder as shown in the below image and click OK.

Image 20

Once done, the project will be added in the assets list and all the related nugget packages required will be restored.

Image 21

Now compile the application.

Test the Application

The only part left is to check if the locate folder extension is actually embedded within isolated shell application or not. So just run the application. The splash screen will be launched.

Image 22

When Isolated shell application opens up, create a new project via File->New->Project.

Image 23

Choose a blank solution, give it a name of choice.

Image 24

Add a new or existing file in that solution.

Image 25

Now right click on the file to check if the "Open in file explorer extension is present or not".

Image 26

One will get to see the Open in File Explorer extension shown on the context menu of the file as used to display in the experimental instance in the first part. This proves that the extension is successfully embedded in Visual Studio Isolated Shell application. Now one can test the extension by actually clicking on the command, and it will open the file location with the file selected.

Image 27

Conclusion

This article explained how we can create a simple Visual Studio Isolated Shell application. With this power of Visual Studio, one can create a new product altogether or a new IDE and leverage the inbuilt functionalities of Visual Studio as well. The "Good Reads" and "References" section of this article are important if one wants to explore Isolated shell application in more detail.

Good Reads

References

Complete Source Code

Extension at Marketplace

History

  • 8th March, 2017: Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect https://codeteddy.com/
India India
Akhil Mittal is two times Microsoft MVP (Most Valuable Professional) firstly awarded in 2016 and continued in 2017 in Visual Studio and Technologies category, C# Corner MVP since 2013, Code Project MVP since 2014, a blogger, author and likes to write/read technical articles, blogs, and books. Akhil is a technical architect and loves to work on complex business problems and cutting-edge technologies. He has an experience of around 15 years in developing, designing, and architecting enterprises level applications primarily in Microsoft Technologies. He has diverse experience in working on cutting-edge technologies that include Microsoft Stack, AI, Machine Learning, and Cloud computing. Akhil is an MCP (Microsoft Certified Professional) in Web Applications and Dot Net Framework.
Visit Akhil Mittal’s personal blog CodeTeddy (CodeTeddy ) for some good and informative articles. Following are some tech certifications that Akhil cleared,
• AZ-304: Microsoft Azure Architect Design.
• AZ-303: Microsoft Azure Architect Technologies.
• AZ-900: Microsoft Azure Fundamentals.
• Microsoft MCTS (70-528) Certified Programmer.
• Microsoft MCTS (70-536) Certified Programmer.
• Microsoft MCTS (70-515) Certified Programmer.

LinkedIn: https://www.linkedin.com/in/akhilmittal/
This is a Collaborative Group

779 members

Comments and Discussions

 
GeneralMy Vote of 5 Pin
RaviRanjanKr14-Mar-17 18:33
professionalRaviRanjanKr14-Mar-17 18:33 
GeneralRe: My Vote of 5 Pin
Akhil Mittal14-Mar-17 19:42
professionalAkhil Mittal14-Mar-17 19:42 
GeneralMy vote of 5 Pin
Jacob S Mathew14-Mar-17 18:23
professionalJacob S Mathew14-Mar-17 18:23 
GeneralRe: My vote of 5 Pin
Akhil Mittal14-Mar-17 18:29
professionalAkhil Mittal14-Mar-17 18:29 
QuestionIt's gone Pin
us471113-Mar-17 5:23
us471113-Mar-17 5:23 
AnswerRe: It's gone Pin
Akhil Mittal14-Mar-17 17:38
professionalAkhil Mittal14-Mar-17 17:38 
QuestionUseful Info Pin
sachin verma8-Mar-17 22:57
professionalsachin verma8-Mar-17 22:57 
AnswerRe: Useful Info Pin
Akhil Mittal14-Mar-17 17:39
professionalAkhil Mittal14-Mar-17 17:39 
GeneralMy vote of 5 Pin
prashita gupta8-Mar-17 15:37
prashita gupta8-Mar-17 15:37 
GeneralRe: My vote of 5 Pin
Akhil Mittal8-Mar-17 17:20
professionalAkhil Mittal8-Mar-17 17:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.