Javier Hertfelder
Javier Hertfelder

Reputation: 2432

Why I am getting a Visual Studio Extension temporary name

I have developed a VS Extension (VSIX) and I need to know exactly where that Extension is installed.

I know that should be installed somewhere in this folder:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions"

However, it seems to be in a folder with a random name:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions**kwsjp3kd.f5k**"

So, my question is this: How can I install my extension in a folder with a name that I have previously selected, like this?

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions**MyExtension**"

Upvotes: 0

Views: 172

Answers (2)

leozhwang
leozhwang

Reputation: 61

My solution:

I use this api get vsix install physical path:

string path = System.Reflection.Assembly.GetExecutingAssembly().Location;

path = \AppData\Local\Microsoft\VisualStudio\...\Extensions\[install path]\xx.dll

Upvotes: 0

Matze
Matze

Reputation: 5508

I am using a helper method that obtains the package installation folder from the codebase of the assembly that defines my package class...

internal static string GetPackageInstallationFolder()
{
    Type packageType = typeof(MyPackage);
    var assemblyCodeBaseUri = new Uri(packageType.Assembly.CodeBase, UriKind.Absolute);
    var assemblyFileInfo = new FileInfo(assemblyCodeBaseUri.LocalPath);
    return assemblyFileInfo.Directory.FullName;
}

Upvotes: 1

Related Questions