5

In app.config i'm using

<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>

to load dll in OracleLibs subfolder but when run program i get an error:

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)

Anyone have any idea to fix this. Thanks

  • 1
    I have found the answer in this topic: http://stackoverflow.com/questions/1892492/set-custom-path-to-referenced-dlls?lq=1 `var dllDirectory = @"C:/some/path"; Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + ";" + dllDirectory)` – Quang Trường Nguyễn Apr 26 '16 at 06:45

1 Answers1

0

First, are you referencing the .dll?

Second, does this address your issue? Oracle.DataAccess still try to access oraops12.dll after uninstall

Third, does this address your issue? Unable to load DLL “OraOps10.dll”

Community
  • 1
  • 1
Ranger
  • 1,139
  • 1
  • 13
  • 34
  • 1
    If I put the dll in the root folder, the program works. But I want to put in a sub folder, to be more organized. I don't have oracle client on my machine. In this project i'm using 3rd libs – Quang Trường Nguyễn Apr 26 '16 at 04:22
  • @QuangTrườngNguyễn Did you try (in the Solution Explorer) right clicking on "References," selecting "Add reference," clicking "Browse," and then navigating to the .dll in its desired location? – Ranger Apr 26 '16 at 14:09
  • @Quang Trường Nguyễn, I am trying to achieve the same thing, i.e. organize the dll outside of the root folder, but when I do that the exe cannot find them. I am using a C++ exe calling a .NET COM Interop dll. – windchaser Sep 22 '18 at 15:53