在config檔裡加上runtime 的區塊,如下

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin"/>
</assemblyBinding>
</runtime>
</configuration>

privatePath屬性,可以指定多個資料夾,用分號區隔開,但資料夾位置只能在應用程式的子路徑下。

例:<probing privatePath="bin;bin2\subbin;bin3"/>

也可以利用程式的方式加入

AppDomain.CurrentDomain.AppendPrivatePath("bin");
AppDomain.CurrentDomain.AppendPrivatePath("bin2");

MSDN 參考資料 http://msdn.microsoft.com/en-us/library/system.appdomain.relativesearchpath.aspx

arrow
arrow
    全站熱搜

    丫烈客 發表在 痞客邦 留言(0) 人氣()