Click here to Skip to main content
13,293,369 members (48,653 online)
Click here to Skip to main content
Add your own
alternative version


25 bookmarked
Posted 15 Sep 2013

.NET Shell Extensions - Deploying SharpShell Servers

, 15 Sep 2013
Rate this:
Please Sign up or sign in to vote.
Learn how to deploy SharpShell servers easily with the new Server Registration Manager tool.


For the last few months, I've been working hard on the SharpShell project. This is a project that lets you quickly build Windows Shell Extensions using the .NET Framework. One difficulty that users were facing is that to deploy a Shell Extension written in .NET, you had to use the regasm tool, which would only be installed generally on development machines.

With SharpShell 2.0, there is a Server Registration Manager tool that makes deploying SharpShell servers a peice of cake.

The Series  

This article is part of the series '.NET Shell Extensions', which includes: 

  1. .NET Shell Extensions - Shell Context Menus  
  2. .NET Shell Extensions - Shell Icon Handlers  
  3. .NET Shell Extensions - Shell Info Tip Handlers     
  4. .NET Shell Extensions - Shell Drop Handlers   
  5. .NET Shell Extensions - Shell Preview Handlers   
  6. .NET Shell Extensions - Shell Icon Overlay Handlers
  7. .NET Shell Extensions - Shell Thumbnail Handlers
  8. .NET Shell Extensions - Shell Property Sheets    
  9. .NET Shell Extensions - Deploying SharpShell Servers 

What is SharpShell?  

SharpShell is a very lightweight class library that lets you build Windows Shell Extensions using the .NET Framework. As you can see from the links above, there are lot's of different types of servers that are supported. You can find a good intro on the GitHub page, as well as examples of each type of server:  

Deploying Shell Extensions 

Deploying Shell Extensions written in C or C++ is generally straightforward, as the regsvr32 tool which is included in Windows can be used. However, to deploy a managed Shell Extension, the regasm tool must be used, which is not included by default on Windows. I have added the 'Server Registration Manager' tool (srm.exe) to SharpShell which makes it easy to install and uninstall servers. 

Installing Servers from the Command Line  

Download the SharpShell Tools binaries from this article, or get the latest from Using this tool, you can install servers like this:

srm install server.dll -codebase 

Easy! You can uninstall the same server like this:

srm uninstall server.dll 

This is the key take-home from this article. The srm tool can install and uninstall servers - all other mechanisms (such as Windows Installers) will simply use this under the hood.

Creating an Installer for SharpShell Servers 

In this example, I'll use Visual Studio 2010 to create an installer for the 'Count Lines' extension that was written in the first article.

Tip: You can also use WiX - just create a custom action to run the commands shown above!

Step 1: Create the Installer Project

Create a new 'Setup and Deployment' project from Visual Studio 2010. Now add your SharpShell server and the srm.exe tool to the application folder, like so:

Step 2: Add Custom Actions to Install and Uninstall

Now navigate to the 'Custom Actions' section of the installer. Create a new 'Install' custom action that executes the srm.exe tool from the application folder: 

You can click on this action to set the properties. We'll need to pass the arguments 'install', the path to the server, and the '-codebase' flag (telling to install the server directly, not using a reference to the GAC).

Make sure that the 'InstallerClass' property is set to False, otherwise the installer will try and load an Installer Class object from the exe, which it doesn't contain.

Now create a similar action for Uninstall - this time we need the 'uninstall' command on the commandline, the server path as before, and no -codebase flag. This is the command line I use in this example:

uninstall "[TARGETDIR]\CountLinesExtension.dll" 

 That's it! You can now run your installer to install the SharpShell server!

Final Thoughts

This is a very short and sweet article, but many users who have been working with SharpShell have been requesting an easier way to deploy their servers, so here it is! 


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


About the Author

Dave Kerr
Software Developer
United Kingdom United Kingdom
Follow my blog at and find out about my charity at

You may also be interested in...

Comments and Discussions

Questionhow to register sharpshell using regasm. Pin
Sourabh111129-Mar-17 22:14
memberSourabh111129-Mar-17 22:14 
BugRe: how to register sharpshell using regasm. Pin
Ross Holder27-Oct-17 12:17
groupRoss Holder27-Oct-17 12:17 
QuestionIssues while deploying Pin
midhun sankar4-Aug-16 12:53
membermidhun sankar4-Aug-16 12:53 
Questionruntime Error when installing a Server Pin
Member 1168474312-May-15 6:33
memberMember 1168474312-May-15 6:33 
QuestionTroubleshooting deployment on End-User environment Pin
Diego Stamigni17-Apr-15 6:28
memberDiego Stamigni17-Apr-15 6:28 
Questionhow extension registration could be done in End-User Computer? Pin
mn_acer117-Mar-15 12:30
membermn_acer117-Mar-15 12:30 
QuestionRestarting the Explorer Pin
Zeveloper2-Oct-14 10:01
memberZeveloper2-Oct-14 10:01 
AnswerRe: Restarting the Explorer Pin
Dave Kerr13-Oct-14 21:59
mvpDave Kerr13-Oct-14 21:59 
QuestionInstallshield Limited Edition Pin
Member 1109573024-Sep-14 23:29
memberMember 1109573024-Sep-14 23:29 
AnswerRe: Installshield Limited Edition Pin
Dave Kerr30-Sep-14 18:33
mvpDave Kerr30-Sep-14 18:33 
AnswerRe: Installshield Limited Edition Pin
Stocklone4-Jan-17 6:46
memberStocklone4-Jan-17 6:46 
AnswerRe: Installshield Limited Edition Pin
Stocklone4-Jan-17 6:46
memberStocklone4-Jan-17 6:46 
GeneralThank you! Pin
JulienV10-Mar-14 22:57
memberJulienV10-Mar-14 22:57 
GeneralRe: Thank you! Pin
Dave Kerr11-Mar-14 6:52
mvpDave Kerr11-Mar-14 6:52 
Questionsrm.exe crashing when registering example DLLs Pin
AlexanderPD8-Jan-14 1:51
memberAlexanderPD8-Jan-14 1:51 
AnswerRe: srm.exe crashing when registering example DLLs Pin
Dave Kerr17-Jan-14 22:18
mvpDave Kerr17-Jan-14 22:18 
GeneralRe: srm.exe crashing when registering example DLLs Pin
bkaratte26-Jan-15 15:13
memberbkaratte26-Jan-15 15:13 
GeneralRe: srm.exe crashing when registering example DLLs Pin
Dave Kerr1-Feb-15 21:37
mvpDave Kerr1-Feb-15 21:37 
QuestionProcess cannot access the file Pin
Marla Sukesh25-Oct-13 19:42
memberMarla Sukesh25-Oct-13 19:42 
AnswerRe: Process cannot access the file Pin
Kugel Ball25-Nov-13 3:49
memberKugel Ball25-Nov-13 3:49 
GeneralRe: Process cannot access the file Pin
Dave Kerr25-Nov-13 9:34
mvpDave Kerr25-Nov-13 9:34 
QuestionAdmin access Pin
RudolfkingRegnor10-Oct-13 4:12
memberRudolfkingRegnor10-Oct-13 4:12 
AnswerRe: Admin access Pin
Dave Kerr12-Oct-13 6:51
mvpDave Kerr12-Oct-13 6:51 
GeneralAnd again! Pin
Brisingr Aerowing15-Sep-13 4:58
professionalBrisingr Aerowing15-Sep-13 4:58 
GeneralRe: And again! Pin
Dave Kerr15-Sep-13 6:42
mvpDave Kerr15-Sep-13 6:42 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171207.1 | Last Updated 15 Sep 2013
Article Copyright 2013 by Dave Kerr
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid