How to find R# plugin installation folder

Hi,

Writing a R# plugin and need to get its installation folder. I know that Shell.Instance.InstallDir gives you the install dir of R# - but is there a way to get the install dir of my plugin?

Currently I use Shell.Instance.InstallDir + "\\Plugins\\MyPlugin" but that's obviously not good.

Thanks,
Andrew

4 comments
Comment actions Permalink

Hello Andrew,

You can use your assembly code base, I think.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


AK> Hi,
AK>
AK> Writing a R# plugin and need to get its installation folder. I know
AK> that Shell.Instance.InstallDir gives you the install dir of R# -
AK> but is there a way to get the install dir of my plugin?
AK>
AK> Currently I use +Shell.Instance.InstallDir + "
Plugins
MyPlugin"+
AK> but that's obviously not good.
AK>
AK> Thanks,
AK> Andrew
AK> ---
AK> Original message URL:
AK> http://www.jetbrains.net/devnet/message/5243901#5243901


0
Comment actions Permalink

Hi Ilya,

Not sure I understand.

0
Comment actions Permalink

Hello Andrew,

In your plugin:
var pathToMyAssembly = new Uri(Assembly.GetExecutingAssembly().CodeBase,
UriKind.Absolute).LocalPath;

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


IR> Hi Ilya,
IR>
IR> Not sure I understand.
IR>
IR> ---
IR> Original message URL:
IR> http://www.jetbrains.net/devnet/message/5243911#5243911


0
Comment actions Permalink

Thanks Ilya!

Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) does the job as well - I think I'd better use this one, for brevity.

0

Please sign in to leave a comment.