简体   繁体   English

AppDomain.CurrentDomain.BaseDirectory和Application.ExecutablePath在实践中有什么区别?

[英]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). 根据MSDN,BaseDirectory是AppDomain将查找要加载的DLL的位置,而ExecutablePath将提供原始可执行文件的路径(包括文件名)。 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. 我知道如果我创建一个新的AppDomain,我可以给它一个不同的路径。 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? 但是从ExecutablePath中删除文件名并假设我只使用一个AppDomain,实际上,这两个路径有什么区别? Will they always be the same (again, assuming only one AppDomain)? 它们是否总是相同(再次假设只有一个AppDomain)? Is there an instance when they would be different? 有不同的例子吗?

Think of something like ASP.NET where your code is hosted inside another process. 想想像ASP.NET一样,你的代码托管在另一个进程中。 The BaseDirectory is going to be where your code lives, but the ExecutablePath is probably some dll in system32. BaseDirectory将是您的代码所在的位置,但ExecutablePath可能是system32中的一些dll。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AppDomain.CurrentDomain.BaseDirectory会根据应用程序的目标平台进行更改 - AppDomain.CurrentDomain.BaseDirectory changes according to the app's target platform 编写 windows 窗体应用程序时 Application.StartupPath 和 AppDomain.CurrentDomain.BaseDirectory 之间的首选项 - Preference between Application.StartupPath and AppDomain.CurrentDomain.BaseDirectory when writing a windows forms application 为什么 AppDomain.CurrentDomain.BaseDirectory 在控制台应用程序中定位 bin catelog? - Why is AppDomain.CurrentDomain.BaseDirectory targeting bin catelog in console application? AppDomain.CurrentDomain.BaseDirectory 更改为错误的目录 - AppDomain.CurrentDomain.BaseDirectory changes to wrong directory 如何模拟AppDomain.CurrentDomain.BaseDirectory - How to mock AppDomain.CurrentDomain.BaseDirectory Application和AppDomain.CurrentDomain之间有什么区别 - What's the difference between Application and AppDomain.CurrentDomain AppDomain.CurrentDomain.BaseDirectory运行测试后会发生变化吗? - AppDomain.CurrentDomain.BaseDirectory changes after running test? C#Uri AppDomain.CurrentDomain.BaseDirectory相对路径 - C# Uri AppDomain.CurrentDomain.BaseDirectory relative path 运行MVC项目时AppDomain.CurrentDomain.BaseDirectory路径问题 - AppDomain.CurrentDomain.BaseDirectory path issue when running MVC project Application.ThreadException 和 AppDomain.CurrentDomain.UnhandledException 有什么区别? - What's the difference between Application.ThreadException and AppDomain.CurrentDomain.UnhandledException?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM