Could not load file or assembly 'Esri.FileGDBAPI.dll' or one of its dependencies.

4466
2
07-19-2013 07:26 AM
JasonCleaver
Occasional Contributor
??

I downloaded v1.3 of the API onto my Windows 7 32bit computer with VS2012.  I created a simple console application, set the target framework to 4.5, added a reference to the ESRI.FileGDBAPI.dll, and added the following line of code...

Geodatabase geo = Geodatabase.Open("C:/arcgisserver/filedb/New10.gdb");

When I attempt to run the app, I am getting the above error.
0 Kudos
2 Replies
DavidSousa
New Contributor III
You need to put Esri.FileGDBAPI.dll and FileGDBAPI.dll in the same folder as your executable.

If you examine all of the sample programs that we supply, you will see that there is a post-build step in each project which performs this copy operation.  A good starting point for your own applications is to copy and modify one of the sample projects so that you don't have to figure out how to do this yourself.
0 Kudos
JasonCleaver
Occasional Contributor
I was having issues compiling the sample c# projects as well. 

Looking at the build events, I see a pre-build event the executes the CopyFileGDBAPI.bat script, and I can see the dlls in the bin directory after I build the project.  Unfortunately, I was getting this error message

"Could not load file or assembly 'Esri.FileGDBAPI.dll' or one of its dependencies.  is not a valid Win32 application"

So I made sure I the solution and all projects were x86, and then tried to debug it again.

I also read the ReadMe.txt file to make sure I wasn't missing anything. 

The only way I can get the project to compile, is by adding a the FileGDBAPI.dll to the project, and have the dll copied to the bin directory.

So this was my last resort, posting a question on this forum after hours of wrestling with it.

After I posted this question, I was able to find an earlier posting that mentioned the FileGDBAPI.dll had to be in the same directory as the executable.
0 Kudos