首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何将程序集Oracle.DataAccess的app.config从版本'2.112.2.0‘重新映射到'2.112.3.0’

如何将程序集Oracle.DataAccess的app.config从版本'2.112.2.0‘重新映射到'2.112.3.0’
EN

Stack Overflow用户
提问于 2012-11-09 01:16:15
回答 1查看 6.8K关注 0票数 2

我是C#的新手。

我写了一个Oracle控制台应用程序,它使用ODP用Oracle.DataAccess.Client命名空间与C#数据库连接。我的开发机器使用的是Oracle.DataAccess版本2.112.2.0,开发服务器也使用的是Oracle.DataAccess版本2.112.2.0,程序运行得很好。prod服务器使用更高版本的Oracle.DataAccess版本2.112.3.0,程序无法运行,我得到以下异常。

代码语言:javascript
运行
复制
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89b483f
429c47342' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342'
   at OPSegmentTDs.Programu.Main(String[] args)


I tried installing ODAC for Oracle client 11.2.0.3.0 on my dev machine and added the higher ver of Oracle.DataAccess reference 2.112.3.0 in my application and when I built it I got this warning but the program built successfully.

Consider app.config remapping of assembly "Oracle.DataAccess, Culture=neutral, PublicKeyToken=89b483f429c47342" from Version "2.112.2.0" [] to Version "2.112.3.0" [C:\Oracle\OraODP1123\product\11.2.0\client_2\ODP.NET\bin\2.x\Oracle.DataAccess.dll] to solve conflict and get rid of warning.
c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning MSB3247: Found conflicts between different versions of the same dependent assembly.
C:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /platform:AnyCPU /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\Work\Build\GOLD\GIS2002\GISLib\bin\Debug\GIS.dll /reference:C:\Work\Build\09072012\Linde.Niche.DB\bin\Debug\Linde.Niche.DB.dll /reference:C:\Work\Build\09072012\Linde.Niche.DB.OP\bin\Debug\Linde.Niche.DB.OP.dll /reference:C:\Work\Build\09072012\Linde.Niche\bin\Debug\Linde.Niche.dll /reference:C:\Work\Build\09072012\OPLib\OPLib\bin\Debug\OPLib.dll /reference:C:\Oracle\OraODP1123\product\11.2.0\client_2\ODP.NET\bin\2.x\Oracle.DataAccess.dll /reference:"c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\OPSegmentTDs.exe /target:exe Program.cs Properties\AssemblyInfo.cs

当我尝试在prod服务器上运行新构建时,应用程序崩溃并出现相同的错误

代码语言:javascript
运行
复制
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89b483f
429c47342' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342'
   at OPSegmentTDs.Programu.Main(String[] args)
EN

回答 1

Stack Overflow用户

发布于 2012-12-05 21:46:36

尝试在应用程序的app.config/setup文件夹下复制正确版本的Oracle DLL(从ODAC112030Xcopy_32bit.zip或ODAC112030Xcopy_x64.zip),并将以下内容添加到应用程序的DLL中:

代码语言:javascript
运行
复制
<system.data>
    <DbProviderFactories>
        <remove invariant="Oracle.DataAccess.Client" />
        <add name="Oracle Data Provider for .NET"
            invariant="Oracle.DataAccess.Client"
            description="Oracle Data Provider for .NET"
            type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
    </DbProviderFactories>
</system.data>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13294206

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档