由于 AppDomain.AppendPrivatePath() 已过时,我试图弄清楚如何在我的项目中为当前 AppDomain 指定 PrivateBinPath,而无需启动一个全新的 AppDomain,并且以后能够访问它。
我知道我可以在 AppDomainSetup 对象上设置 PrivateBinPath(如果我想创建一个新的 AppDomain 就可以了),而且我也知道我可以将它添加到我的 app.config 中,如下所示:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath=".\AlternateLookupPath" />
</assemblyBinding>
</runtime>
但是,将此条目添加到我的 app.config 时,AppDomain.CurrentDomain.SetupInformation.PrivateBinPath 属性为空。