Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Log4net.dll + C# + Crystal Reports = error

Forgive me if it has been answered before but I searched the web and found only desperate people asking exactly my question but nobody giving any answer which I could use.

I'm developing an application in C# Visual Studio 2010 which uses Crystal Reports. I'm developing it on 32 bit system. Everything works okay.

Now I'm trying to run it on another computer which is 64 bit system has Crystal Reports installed and some terrible error happens.

************** Tekst wyjątku **************
System.TypeInitializationException: Inicjator typów zgłosił wyjątek dla typu
 'CrystalDecisions.ReportSource.ReportSourceFactory'. ---> System.TypeInitializationException:
 Inicjator typów zgłosił wyjątek dla typu 'CrystalDecisions.Shared.SharedUtils'. --->
 System.IO.FileLoadException: Nie można załadować pliku lub zestawu 

'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' lub jednej z jego zależności.

Forgive me some Polish language there. It basically means that it cannot find some specific version of log4net.dll file which apparently must be used by something.

This problem was described in many places:

log4net not logging and throwing error

http://scn.sap.com/thread/1857957

I understand that my application uses/expects some version of this file and Crystal Reports installed on 64 bit machine uses another version.

Still after browsing the internet I have no idea what steps I should take to correct it.

I would be really grateful for some "tutorial for dummies" how to deal with it.

Oh, and my application needs to be built as 32 bit and run on 64 bit. No possibility of building it as 64 bit, another thing would stop working :(

like image 370
RRM Avatar asked May 27 '13 15:05

RRM


People also ask

What is log4net DLL?

dll in Solution. Log4net is an open-source project based on the work of many authors. It allows the developer to control what log statements are output with arbitrary granularity. It is fully configurable at runtime using external configuration files.

Is log4net a vulnerability?

Vulnerability Details: CVE-2021-44228 (CVE Details) and CVE-2021-44228 (CVE) have the following note: Note that this vulnerability is specific to log4j-core and does not affect log4net, log4cxx, or other Apache Logging Services projects. So, no. Log4Net is fine.

What is the use of log4net in C#?

Log4net provides a simple mechanism for logging information to a variety of sources. Information is logged via one or more loggers. These loggers provide 5 levels of logging: Debug.


2 Answers

Installing CR 32 bit (CRRuntime_32bit_13_0_14.msi) will resolve the error.

The 32 and 64 bit versions can be found here.

like image 65
Jasmine John Avatar answered Sep 19 '22 06:09

Jasmine John


Well, not much response here :) I've learnt a few things myself since then and have thought I would share my knowledge with any poor beginner people that may encounter the similar problem.

So there is something like GAC - http://en.wikipedia.org/wiki/Global_Assembly_Cache You may think of it as a collection of libraries and drivers used by your programs.

It is on your computer in c:/windows/assembly but it is a hidden directory so first you must enable seeing it.

At my 64 bit computer it contained GAC_32 and GAC_64 subdirectories. In GAC_64 there was log4net in:

c:\Windows\assembly\GAC_64\log4net\1.2.10.0__692fbea5521e1304\

In GAC_32 there was nothing. So I created the directory and copied the appropriate file from my 32 computer into it and it worked.

c:\Windows\assembly\GAC_32\log4net\1.2.10.0__692fbea5521e1304\

Still a moment later I faced another error but it is a different story

CrystalDecisions.CrystalReports.Engine.ReportDocument'. ---> System.IO.FileNotFoundException: Nie można załadować pliku lub zestawu 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304

Generally expect that anything using Crystal Reports build on 32 bit computer may give problems when tried to run at 64 bit computer. SAP did really a crappy job with these drivers.

like image 22
RRM Avatar answered Sep 22 '22 06:09

RRM