Scenario : I've created a library project which provides interface to installer(exe created using install shield).I want to check whether a particular file exists in the installer folder.
I've tried following :
1). Assembly.GetEntryAssembly().Location
// Throws "Object reference not set to an instance of an object"
2). new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath
// return : C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
3). Assembly.GetExecutingAssembly().Location
// returns empty string
4). AppDomain.CurrentDomain.BaseDirectory
// returns "C:\Windows\syswow64\" irrespective of the actual path
Could anyone tell me how can I get directory path from where the installer is being executed?
You can use
Directory.GetCurrentDirectory();
to get current directory path
import System.IO
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