简体   繁体   中英

What's the difference between AppDomain.CurrentDomain.BaseDirectory and Application.ExecutablePath in practice?

According to the MSDN, the BaseDirectory is where an AppDomain will look for DLLs to load, while ExecutablePath will provide the path to the original executable file (including file name). I know that one has the file name and the other does not. I know that if I create a new AppDomain I can give it a different path. But removing the file name from ExecutablePath and assuming I'm only using one AppDomain, in practice, what is the difference between those two paths? Will they always be the same (again, assuming only one AppDomain)? Is there an instance when they would be different?

Think of something like ASP.NET where your code is hosted inside another process. The BaseDirectory is going to be where your code lives, but the ExecutablePath is probably some dll in system32.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM