I need to the the bin path of the executing assembly. How do you get it? I have a folder Plugins in the Bin/Debug and I need to get the location
The bin directory in Unix-like systems contains the programs of the system and the installed ones, but in Windows, system programs are located in C:\Windows\System32 and installed ones are likely located in C:\Program Files .
This is a list of folders that Windows searches, in order, when it can't find a dll (say) in the current directory. So if you want to have a dll used by more than one program you could put it in a location already on the PATH or add a new folder to the PATH. Copy link CC BY-SA 2.5.
You could do this
Assembly asm = Assembly.GetExecutingAssembly(); string path = System.IO.Path.GetDirectoryName(asm.Location);
Here is how you get the execution path of the application:
var path = System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
MSDN has a full reference on how to determine the Executing Application's Path.
Note that the value in path
will be in the form of file:\c:\path\to\bin\folder
, so before using the path you may need to strip the file:\
off the front. E.g.:
path = path.Substring(6);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With