I'm building an MVC 3 project which requires a reference, by path, in the controller to an assembly sitting in the \bin\
folder of the project.
Can anybody point me in the right direction to constructing a relative path to the \bin\
folder?
Running the project in debug mode in VS 2010 causes the current directory to be C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0
, so using .\bin\
looks for a bin
folder in that path.
Thanks
You could use current appdomain to get this information.
// 1) get current directory for this loaded assembly // 2) combine path to get \bin folder var path = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "bin");
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