locked
x64 build in vs2010 RRS feed

  • Question

  • User65893105 posted

    Ive inherited an mvc web project that was built with a platform target of x64.  When i compile and run it I get this error

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

    the Oracle.DataAccess.dll is 64 bit, but ive noticed that the corresponding directory is never populated after building

    eg

    C:\Projects\Agg\Trunk\source\TestTool\TestWebsite\bin\x64\Debug

    but this directory is

    C:\Projects\Agg\Trunk\source\TestTool\TestWebsite\bin

    it looks like its been built as a 32 bit app and its put the 64 bit oracle dll in there

    All the dependent projects are set to 'AnyCPU'.  This was working ok on a colleagues machine, but ive been given a new one and hes left the company

    Can anyone shed any light on this ?  as far as im aware, if I set the target platform to x64 it should put the assemblies in the x64 debug folder

    Friday, April 4, 2014 7:50 AM

Answers

  • User65893105 posted

    I managed to resolve it in the end, there was a mismatch with the oracle client .net assembly versions and oracle.dataAccess.dll referenced in my app, so I installed the correct version.  I also used IIS to browse the site and it worked, stangely the built in web server wouldnt work, but cassini would.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 10, 2014 9:32 AM

All replies

  • User753101303 posted

    Hi,

    You are 100% sure that the underlying DLLs Oracle driver is 64 bit ? You could also try to install the 32 bit version and see what happens...

    Try perhaps http://stackoverflow.com/questions/21028803/oracle-an-attempt-was-made-to-load-a-program-with-an-incorrect-format

    What if you try to test a consistent state for *all* projects that is having them all x64 or having them all x86 ? Does it still fail or does it run fine using one of those values.

    If it works it means you find a config for which all the component are fines. If it doesn't it might mean that you mixed up component (ie you do have something that can run only in x86 and another one that can run only in x64 causing both configuration to fail).

     

     

    Friday, April 4, 2014 8:12 AM
  • User65893105 posted

    the oracle dll is referenced in the project here

    C:\Projects\Agg\Trunk\source\TestTool\Tools.Common\ExternalDll\64bit\Oracle.DataAccess.dll

    I should reword my original post

    If I set the target platform to x64  I get this error at runtime

    Could not load file or assembly 'TestWebsite' or one of its dependencies. An attempt was made to load a program with an incorrect format.

    If I set it to 'AnyCpu'  I get this

    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.

    (I get the same for x86)

    this was working fine on the other machine, Ive just loaded it in from subversion

    Friday, April 4, 2014 8:27 AM
  • User65893105 posted

    ok, ive just run corflags on the oracle assembly, heres what i got

    Version     v2.0.50727

    CLR Header   2.5

    PE   PE32

    CorFlags   11

    ILONLY    1

    32 bit      1

    Signed     1

    the main app has a .net target framework set to 4  and it looks like the oracle assembly is 32 bit, despite being referenced in a 64 bit folder, so surley if i set the target to AnyCpu this should work ??  but I get the error in the website assembly If i do that

    Friday, April 4, 2014 8:40 AM
  • User65893105 posted

    Ive logged on to the machine the other developer was using and checked the Oracle.DataAccess.dll on his machine and its 64 bit !  looks like he didnt update the version we have in subversion.  Ive done that now and am referencing the 64 bit version.  Im still having problems though.

    x64 gives this error at runtime

    Could not load file or assembly 'TestWebsite' or one of its dependencies. An attempt was made to load a program with an incorrect format.

    AnyCpu gives this error at runtime

    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.

    Ive gone into the bin directory and checked the oracle .dll and its 64 bit !  I have no idea whats going on, can anyone help ?

    Friday, April 4, 2014 9:25 AM
  • User-166373564 posted

    Hi,

    Thanks for your feedback.

    Ive gone into the bin directory and checked the oracle .dll and its 64 bit ! 

    Here are some suggestions for you.

    • Open IIS Manager, change application pool's advance setting, change Enable 32 bit Application to false.
    • Oracle.DataAccess.dll must be installed not only referenced.
    • Change the copy local property of the reference to true.

    hope it helps.

    Regards

    Angie

    Monday, April 7, 2014 4:03 AM
  • User65893105 posted

    I managed to resolve it in the end, there was a mismatch with the oracle client .net assembly versions and oracle.dataAccess.dll referenced in my app, so I installed the correct version.  I also used IIS to browse the site and it worked, stangely the built in web server wouldnt work, but cassini would.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 10, 2014 9:32 AM