2016-04-26 74 views
1

在App.config中我使用C# - 探测privatePath不工作

<configuration> 
<configSections> 
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > 
     <section name="SMSGateway.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
    </sectionGroup> 
</configSections> 
<startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> 
</startup> 
<runtime> 
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
    <probing privatePath="OracleLibs" /> 
</assemblyBinding> 
</runtime> 
</configuration> 

加载在OracleLibs子文件夹中的DLL但运行程序时,我得到一个错误:

OracleConnection Error: System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'OraOps12.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

任何人有任何想法解决这个问题。谢谢

+0

我发现这个主题的答案:http://stackoverflow.com/questions/1892492/set-custom-path-to-referenced-dlls?lq=1 'VAR dllDirectory = @“C: /一些/路径“; Environment.SetEnvironmentVariable(“PATH”,Environment.GetEnvironmentVariable(“PATH”)+“;”+ dllDirectory)' –

回答

0

首先,你是指的.dll?

其次,这是否解决您的问题? Oracle.DataAccess still try to access oraops12.dll after uninstall

三,这是否解决您的问题? Unable to load DLL “OraOps10.dll”

+0

如果我把dll放在根文件夹中,程序就可以工作。 但我想放在一个子文件夹,更有组织。 我的机器上没有oracle客户机。在这个项目中,我正在使用第三个库。 –

+0

@QuangTrườngNguyễn您是否尝试过(在解决方案资源管理器中)右键单击“参考”,选择“添加引用”,单击“浏览”,然后导航到.dll所需的位置? –