C# Project, GAC, DLL

0

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

c#
dll
gac
cil
openoffice-calc
asked on Stack Overflow Apr 2, 2013 by Cheese • edited Jan 31, 2017 by Alicia

2 Answers

0

Change your Platform from AnyCPU to x86.

answered on Stack Overflow Aug 2, 2013 by Cheese • edited Jul 24, 2019 by cs95
0

For those that find this in the future.

The problem is that the targeted platform in Visual Studio is incorrect. The .dlls need to be compiled with the correct bit version.

You need to change the targeted platform in Visual Studio to:

  • 64-bit -> x64
  • 32-bit -> x86

Note: AnyCPU does not work.

answered on Stack Overflow Jan 9, 2019 by P Riebs

User contributions licensed under CC BY-SA 3.0