Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7459163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T14:24:36+00:00 2026-05-29T14:24:36+00:00

I am making changes to a Visual Studio wizard that creates a project from

  • 0

I am making changes to a Visual Studio wizard that creates a project from a template, and needs to add a reference to an assembly to the project that also lives in the extension directory. So I need to set the <hintpath>.

I have not been able to figure out how a running VS extension can discover its extension directory, which is a directory name like this:

%USERPROFILE%\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\myCompany\myExtension

Using System.Reflection.Assembly.GetExecutingAssembly().CodeBase yields:

“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\myCompany.myExtension\v4.0_1.0.0.0__936015a19c3638eb\myCompany.myExtension.dll”

Unfortunately, not helpful. Using GetCallingAssembly() is no better–it points at another directory in the MSIL_GAC.

Is there a Visual Studio interface that returns this information? I haven’t been able to find it.

If that’s not possible, is it at least possible to determine if the extension is running in the experimental instance vs. non-experimental? I could use that information to locate the extension directory.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T14:24:39+00:00Added an answer on May 29, 2026 at 2:24 pm

    Maybe look at IInstalledExtension.InstallPath. You can get an IInstalledExtension via an IVsExtensionManager.

    Unfortunately, the message in the remarks suggests this is not the right way to do things:

    Although this API supports the Extension Manager infrastructure, we recommend that you do not use it because it is subject to change.

    EDIT: Here’s the code:

        static IVsExtensionManager GetExtensionManager()
        {
            return myPackage.GetService(System.typeof(IVsExtensionManager)) as IVsExtensionManager;
        }
        static IInstalledExtension GetExtension(string identifier)
        {
            return GetExtensionManager().GetInstalledExtension(identifier);
        }
        static string GetExtensionDirectory(string identifier)
        {
            return GetExtension(identifier).InstallPath;
        }
    

    The string identifier is whatever you put in the “ID” field of your extension’s source.extension.vsixmanifest file. It defaults to the package GUID.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been making changes to a Windows Service in Visual Studio (2010, .NET 4.0
We're making the switch from SourceGear Vault to TortoiseSVN with VisualSVN for Visual Studio
I'm getting a build error in Visual Studio that's not making any sense: The
I am making an Add in for Visual Studio. Every time a change something
I'm having an issue with a Visual Studio 2008 web application project where changes
Often when making changes to a VS2008 ASP.net project we get a message like:
I am making changes to an old program written in VC++6. the project resources
Help I am busy making changes to a type library in a Datasnap project.
I'm going to be making changes to my version of GEdit. I would also
I've been having a look at making changes to the partial classes generated from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.