Search code examples
c#dllgaccilopenoffice-calc

C# Project, GAC, DLL


i'm having a problem with my built Application.

I have a project taken from here modified it and implemented in my program.
Shortly, this TableProc project generates a report to OpenOffice Calc and uses some libraries from OpenOffice - cli_basetypes (GAC/MSIL), cli_oootypes (GAC/MSIL), cli_uno (GAC/MSIL), cli_ure (GAC/MSIL), cli_uretypes (GAC/MSIL) AND cli_cppuhelper (GAC32).

Looks like:
Solution
.....Project1 (references TableProc)
.....Project2 (references TableProc)
.....TableProc (implemented) (references on libraries in bin directory cli_basetypes.dll and others)

So, when i'm in debugging mode VS 2010, those DLL are in directory */bin/ - Everything works fine - reports are done.

But when i build up my application:
1. There are no DLL's for cli_basetypes, cli_oootypes and others
2. There are project1.dll, project2.dll and TableProc.dll and Program.exe

PROBLEM:

In a built up application, it tells that:

Error 1:

Could not load file or assembly 'cli_cppuhelper, Version=1.0.14.0, Culture=neutral, PublicKeyToken=ce2cb7e279207b9e' or one of its dependencies. Ann attempt was made to load a programm with an incorrect format.)

Ok, I tried to manually put those DLL's next to my Program.exe - same error.

Then I found out, that those libraries are installed in GAC when you install Open Office. I looked at them, and noticed that all of them are installed in GAC/MSIL but cli_cppuhelper is installed in GAC/32.

I tried to manually copy cli_cppuhelper assembly from GAC/32 to GAC/MSIL, and got this error:

Error 2:

Is not a valid Win32 application. (Exception from HRESULT: 0x800700C1))

From this i understood, that my apllication, when looks for DLL's it looks only in GAC/MSIL

Please help, i don't know what to do...


Solution

  • Change your Platform from AnyCPU to x86.