I just ran into this issue, and after solving it I figured someone else might be interested in the solution, so I figured I'd post it here for posterity. I was unable to find a solution to this problem searching online, so hopefully this will get indexed by the search engines and the next person with this kind of problem won't have to spend so much time trying to solve it. :)
In my current project, I'm using an SQL CE database to store Intellisense information (much like is already done for VC++ projects, but this is for my own type of source file). It seemed somewhat pointless (and error prone) to have the extension create the database by hand when a new project was opened (and would also mean that my LINQ to SQL bindings could become out of sync if I changed the base SQL database without changing the code that created the new one correctly), so I figured it best to keep a copy of the empty database installed as part of the extension.
But how to get access to that installed file at runtime, when I need to copy the empty database to where it needs to go in order for the rest of my extension to be able to add to it and query information from it, so I can have all the awesome Intellisense stuff available to my scripting language LanguageService? Here's how to get the path that your extension was installed to (sorry, C# only!):
public class MyPackage : Package { private static string s_basePath; public static string BasePath { get { if (s_basePath == null) { Uri uri = new Uri(Path.GetDirectoryName(typeof(MyPackage).Assembly.CodeBase)); s_basePath = uri.LocalPath; } return s_basePath; } } }
I can now use MyPackage.BasePath to get at the location where my extension has been installed, and from there add the name of the empty SQL CE database in order to copy it to where I want it to go.
This same technique is used by Microsoft's Productivity Power Tools extension, so I assume this is the way it's meant to be done. As long as all your raw resource files are included with your VSIX and copied into its install directory (wherever that may be!), this technique should continue to work.