Geeks With Blogs



Utkarsh Shigihalli Microsoft MVP and Microsoft ALM Ranger writing on Visual Studio Extensibility, ALM and .NET

I had previously written on how to load custom assemblies in your extension using AppDomain.CurrentDomain.AssemblyResolve. It required few lines of code to be written in your VS package class. Today I am going to show you an easier way of doing the same.

Visual Studio provides ProvideBindingPath attribute which lets Visual Studio know other paths from where your extension loads the assemblies. The usage of this attribute is very simple, you just need to decorate your package class with it.

public sealed class min2015Package : Package

Once you do that and compile your extension, the <extension>.pkgdef file will be modified to include a new line something like below, where {PackageGuid} will be the guid of your package.


So, when you install the extension, along with other information, this information is also written in the registry. So when Visual Studio is loading your extension, it will also load all the assemblies from the path you have mentioned in to its app domain.

SubPath property

You can also decide to keep all your dependent assemblies in a separate folder under your extension folder. If you decide to do so, you need to mention that using SubPath property. Example below lets Visual Studio know that, the dependent assemblies are References subfolder.


That's it for now. Happy extending Visual Studio!

Posted on Saturday, December 13, 2014 4:46 PM Visual Studio Integrate , Extensions , Visual Studio | Back to top

Comments on this post: Better way to load dependent assemblies in your Visual Studio extensions

comments powered by Disqus

Copyright © Utkarsh Shigihalli | Powered by: