Visual Studio 2013 - Oracle.DataAccess 文件 "cannot be found"
Visual Studio 2013 - Oracle.DataAccess File "cannot be found"
我遇到了一个奇怪的问题。我为 Visual Studio 下载并安装了最新版本的 Oracle ODAC 插件。之后,我将 Oracle.DataAccess 添加到我的项目引用中,在 "using" 语句中添加它,然后是 运行 程序。在运行时开始时,我收到此错误:
System.IO.FileNotFoundException was unhandled
Message: An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
Additional information: Could not load file or assembly 'Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
我不太明白是什么导致了这个错误。
您不能只使用最新版本的 ODAC。
ODAC 的体系结构(即 32 位或 64 位)必须与您安装的 Oracle 客户端相匹配。两者还必须在编译器设置中匹配您的目标架构。
对于 ODAC 版本 4。121.x 您必须安装 Oracle Client 版本 12.1。
您的编译器目标 .NET Framework 必须是版本 4(或更高版本)
如果您使用 ODP.NET 托管驱动程序,这一切都不适用,您只需使用并复制单个 DLL Oracle.ManagedDataAccess.dll
我遇到了一个奇怪的问题。我为 Visual Studio 下载并安装了最新版本的 Oracle ODAC 插件。之后,我将 Oracle.DataAccess 添加到我的项目引用中,在 "using" 语句中添加它,然后是 运行 程序。在运行时开始时,我收到此错误:
System.IO.FileNotFoundException was unhandled
Message: An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
Additional information: Could not load file or assembly 'Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
我不太明白是什么导致了这个错误。
您不能只使用最新版本的 ODAC。
ODAC 的体系结构(即 32 位或 64 位)必须与您安装的 Oracle 客户端相匹配。两者还必须在编译器设置中匹配您的目标架构。
对于 ODAC 版本 4。121.x 您必须安装 Oracle Client 版本 12.1。
您的编译器目标 .NET Framework 必须是版本 4(或更高版本)
如果您使用 ODP.NET 托管驱动程序,这一切都不适用,您只需使用并复制单个 DLL Oracle.ManagedDataAccess.dll