Dot-Net

探測 privatePath 和子目錄

  • October 27, 2015

在我的應用程序中,我想將 DLL 文件放在子目錄中。我正在使用probingapp.config 中的元素,它工作得很好,但是我遇到了本地化程序集的問題。

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
   <probing privatePath="libs"/>
</assemblyBinding>

如果我有兩個 DLL:

libs/de/myAssembly.dll

libs/myAssembly.dll

第一個已載入,而我希望根文件夾中的文件是首選。我怎樣才能做到這一點?

您可以設置多個探測路徑。

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
   <probing privatePath="libs;libs/de;libs/fr"/>
</assemblyBinding>

請參閱有關探測元素的官方微軟文件

引用自:https://stackoverflow.com/questions/21931312