1 Reply Latest reply: Mar 12, 2013 6:08 AM by Tridus RSS

    ASPNETCOMPILER error ASPCONFIG Could not load file or assembly Oracle.Data

    996282
      I have migrated my .Net solution from 3.5 to 4.0 which consist of a class library and a web service. Web serivice is dependent on class library and the class library uses oracle.dataaccess.dll version 4.112.3.0. I have installed ODAC 11.2.0 in my machine.

      When I try to build the solution using MSBUILD.EXE I am getting the below error on my build machine.

      ASPNETCOMPILER : error ASPCONFIG: Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format. [D:\VEROS_BuildFolder\CDDS_MERGE_CODEDROP_.NETUPGRADE\WEB Services\AppraisalSubmission\AppraisalSubmissionService.metaproj]

      And I try to build from VS2010, it is building successfully.

      But we need to build only using MSBUILD.EXE which resides in "C:\Windows\Microsoft.NET\Framework\v4.0.30319" path. While building using MSBUILd.EXE the Oracle.DataAccess.dll is getting copied into the BIN folder of the web service. It should reference from GAC location. My build serveer is 64 bit win2008 server. when I checked the dll version install using GACUTIL , I got the below result

      C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools>gacutil /l oracle.dataaccess
      The Global Assembly Cache contains the following assemblies:
      oracle.dataaccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64
      oracle.dataaccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64
      oracle.dataaccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86

      Previous the application was building successfully using framework 3.5 and Oracle.DataAccess.dll version 2.112.3.0.

      Please help to build my applicaiton using MSBUILD 4.0 version.
        • 1. Re: ASPNETCOMPILER error ASPCONFIG Could not load file or assembly Oracle.Data
          Tridus
          Typically, when you get the "load a program with an incorrect format" exception, it's a mismatch in the bit-ness of the Oracle client you're using and the project you're building. By default, .net builds in AnyCPU mode. That means if you do it on a 64 bit system, you'll get a 64 bit (x64) program. That doesn't work with a 32 bit Oracle client. Usually, you'll need to force MSBUILD to build a 32 bit (x86) result. That will use the 32 bit Oracle client successfully. There's probably a command line switch for that. When building in Visual Studio, you can do it from the Build > Configuration Manager menu.

          Now in this case it looks like you actually have both 32 and 64 bit versions of Oracle.DataAccess in the GAC, so I'm not sure if you have both Oracle clients or not. If you have one in the \bin with Copy Local = True, you could be getting the wrong one. You'll want to set Copy Local = False on the properties of the reference and remove that file from the \bin.