Oracle.Dataaccess在GAC中.我可以控制使用的版本吗? [英] Oracle.Dataaccess is in the GAC. Can I control the version I use?

查看:81
本文介绍了Oracle.Dataaccess在GAC中.我可以控制使用的版本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Oracle.DataAccess(ODP.NET)的XCOPY可部署.NET应用程序.我们还将Oracle Instant Client部署在应用程序目录中.一切正常,但我担心..

I have a XCOPY deployable .NET application using Oracle.DataAccess (ODP.NET). We also deploy the Oracle Instant client in the application directory. Everything works OK, but I worry..

从Oracle ODP.NET常见问题解答中:

From the Oracle ODP.NET FAQ:

从ODP.NET 10.1.0.3开始,Oracle安装程序将注册 全局程序集缓存(GAC)中的以下发布者策略DLL 重定向9.2、10.1和10.2 ODP.NET应用程序以使用最后一个 ODP.NET的已安装版本:Policy.9.2.Oracle.DataAccess.dll和 Policy.10.1.Oracle.DataAccess.dll

Beginning with ODP.NET 10.1.0.3, the Oracle installer will register the following publisher policy DLLs in the Global Assembly Cache (GAC) that redirect 9.2, 10.1 and 10.2 ODP.NET applications to use the last installed version of ODP.NET: Policy.9.2.Oracle.DataAccess.dll and Policy.10.1.Oracle.DataAccess.dll

这意味着在安装了Oracle ODP.NET的计算机上,将使用GAC中的版本,而不是我与应用程序一起部署的版本.并且由于发布者的政策,该版本可能比我随应用程序部署的版本新. Oracle.DataAccess需要同时与我的应用程序一起部署的Oracle(即时)客户端.这些是本机Win32 DLL,因此将使用我的版本.

This means that on machines where the Oracle ODP.NET is installed, the version in the GAC will be used, not the one I deploy with my application. And because of the publisher policy, that version may be newer than the one I deploy with my application. Oracle.DataAccess needs the Oracle (Instant) client also deployed with my application. These are native Win32 DLLs so my version will be used.

Oracle是否有可能将Oracle.DataAccess升级到与我的应用程序所部署的Oracle Instant Client不兼容的较新版本?因此将来会破坏我的应用程序.

Is is possible that Oracle may upgrade the Oracle.DataAccess to a newer version that may not be compatible with the Oracle Instant Client deployed with my application? And thus breaking my application in the future.

这是问题吗?我可以避免吗?无需在计算机上安装/删除任何内容,我是否可以覆盖Oracle Publishers策略以保证我使用xcopy随应用程序部署的Oracle.Dataaccess版本?

Is this a problem? And can I avoid it? Without installing/removing anything on the machine can I override the Oracle Publishers policy to guarantee that I user the Oracle.Dataaccess version that I xcopy deploy with my application?

对于给定的ODP.NET版本,它支持哪些Oracle Clients版本?新版本的Oracle.DataAccess是否支持旧版本的Oracle(即时)客户端.

For a given version of ODP.NET, what Oracle Clients versions does it support? Will new versions of Oracle.DataAccess support old versions of the Oracle (Instant) Client.

推荐答案

可以强制您的应用程序始终使用所需的ODP和ODAC版本.

It's possible to force your application to always use the ODP and ODAC version you want.

  1. Force ODP版本:使用Robert发布​​的assemblyBinding技巧,强制使用您的Oracle.DataAccess版本而不是GAC版本.例如:

  1. Force ODP version: use the assemblyBinding trick posted by Robert, to force using your version of Oracle.DataAccess instead of the GAC'd version. E.g.:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Oracle.DataAccess"  culture="neutral" publicKeyToken="89b483f429c47342"/>
        <codeBase version="4.112.3.0" href="FILE://Oracle.DataAccess.dll"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

  • 强制ODAC版本:ODP DLL取决于一组共享的Oracle组件(即时客户端,非托管OCI dll).获得这些的一种方法是通过ODAC软件包.您可以(基于每个应用程序)定义要使用的ODAC程序包.传统上,这是通过PATH env变量完成的,但现在可以通过config进行定义:

  • Force ODAC version: The ODP DLL depends on a set of shared Oracle components (instant client, unmanaged OCI dlls). One way to get these is via the ODAC package. You can define (on a per app basis), which ODAC package you want to use. Traditionally this was done via the PATH env variable, but it can now be defined via config:

    <configuration>
      <configSections>
        <section name="oracle.dataaccess.client" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </configSections>
    
      <oracle.dataaccess.client>
        <settings>
          <add name="DllPath" value="C:\somefolder\ODAC_11.2.0.3.0_32bit\bin" />
        </settings>
      </oracle.dataaccess.client>
    </configuration>
    

  • 作为额外的预防措施,您始终可以删除GAC发布的发布商政策DLL,以确保永远不会出现任何时髦事件.

  • As an extra precaution, you can always delete the GAC'd publisher policy DLL, to ensure there is never any funky going on.

    这篇关于Oracle.Dataaccess在GAC中.我可以控制使用的版本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆