Friday, February 5, 2010

Problems with Oracle.DataAccess

Error Message: Could not load file or assembly 'Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

Platform: .net framework 3.5

Application type: console application

Database: Oracle 10

Language: C#

IDE: Visual Studio 2008.

Yesterday, I finished my console application in C#, I built it and I saw in the Debug Folder, the Oracle.Data.dll. I thought it strange because, normally if the dll exists in your computer you don’t need to install the dll together with the executable file.

And… It’s true! If you don’t have any problems with the dll, you don’t need to move the dll with the executable.

What I did: I just use the Global Assembly Cache Tool (gacutil.exe) - the .net version of regsvr32.exe and that’s it. I restarted the Visual Studio 2008 again and It worked.

The exact command that I used was:

gacutil /if C:\oracle\product\10.2.0\client_1\odp.net\bin\2.x\Oracle.DataAccess.dll

the /if option means that you want to install an assembly into the global assembly cache. If an assembly with the same name already exists in the global assembly cache, the tool overwrites it.

You can find out more about the Global Assembly Cache, clicking here