I want find the Path form the Plugin I installed

Hi all

write a plugin and I need the folder I installed the plugin.

I look i a simelar topic " Plugin instali Folder" i found this:

Dictionary<Guid, string> dict = Rhino.PlugIns.PlugIn.GetInstalledPlugIns();
foreach (KeyValuePair<Guid, string> entry in dict)
{
Rhino.PlugIns.PlugIn plugin = Rhino.PlugIns.PlugIn.Find(entry.Key);
if (null != plugin)
{
System.Reflection.Assembly assembly = plugin.Assembly;
if (null != assembly)
{
Rhino.RhinoApp.WriteLine(assembly.Location);
}
}
}

and copy to my c# but “Rhino.PlugIns.PlugIn.Find(entry.Key);” is red

what is wrong I add the using System.Reflection.Assembly;

Thanks Robert

You might want to take a look at this thread: Plugin distribution best practices

1 Like

Thanks for answerd work perfect

I’m using My.Application.Info.DirectoryPath() at the moment. Should this be avoided?

Hi Jordy,

I want give my plugin and some other files in one folder to colleges this file my plugin need ( RHFiles…text files)
and they can install it on C: or D:…

this is the reason if you have c# program i use
appPath = Application.StartupPath;
but insiden from Rhino I get

C:\Program Files\Rhinoceros 5.0 (64-bit)\System
so I look for some other.

if I use know
string assemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location;
string assemblyPath = System.IO.Path.GetDirectoryName(assemblyLocation);
RhinoApp.WriteLine(assemblyPath);

I get the right:

C:\FC_schienen\FC_schienen_2015\bin

If you get My.Application.Info.DirectoryPath() you also get the same as you want :wink:
You get the Plugin Folder. But my question is. Is My.Application.Info.DirectoryPath() wrong to use?

Should I start using?
string assemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location;
string assemblyPath = System.IO.Path.GetDirectoryName(assemblyLocation);

I´m not a expert but I get it not work

if I typ Application. has no Info…