1

I am attempting to deploy a Crystal Reports desktop application, but the application is not able to find my log4net assembly, even though I have verified that my installer is registering the log4net DLL in the GAC. Below is the exception and stack trace.

Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral,
   PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system 
   cannot find the file specified.
at CrystalDecisions.Shared.SharedUtils..cctor()

I am honestly completely lost as to why this isn't working... The versions are the same and everything. Do I need to configure log4net before this will work?

Editing: I am using InstallShield 2012 to install my application assembly to the GAC. The only other things I am installing are a very small exe that references my dll, and a few files in Program Files folder to handle configuration.

gwin003
  • 7,432
  • 5
  • 38
  • 59
  • Since it might be a dependency of log4net, rather than the dll itself, you may want want to try Procmon - http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx - or something similar to see which DLL its searching for and failing to find. – The other other Alan May 21 '13 at 19:31
  • The `CrystalDecisions.Shared.SharedUtils` class references `log4net`. I have used JustDecompile and checked this already. The `SharedUtils` is the class that is unable to find `log4net` – gwin003 May 21 '13 at 19:35
  • Why put it in GAC? Put it in application bin. – alanh May 21 '13 at 19:37
  • When I deploy my application to the client, it needs to be in the GAC... Why would there be a bin directory on the client? – gwin003 May 21 '13 at 19:41
  • I think he means in the same folder as the application binaries you will be deploying to the client. Is there a reason you can't put log4net in the same folder as the app itself? – The other other Alan May 21 '13 at 19:44
  • My application binaries are installed to the GAC. – gwin003 May 21 '13 at 19:45
  • Have you tried this? http://stackoverflow.com/questions/4208516/crystal-reports-error-when-deployed-could-not-load-file-or-assembly-log4net – The other other Alan May 21 '13 at 19:55
  • Just tried it... doesn't seem to help. – gwin003 May 21 '13 at 20:10

3 Answers3

1

Turns out I was using the same version of the dll, but the one I was using had a different PublicKeyToken. After I fixed that, it worked.

gwin003
  • 7,432
  • 5
  • 38
  • 59
  • How did you fix it? We have the same problem. – Program.X Apr 02 '14 at 14:20
  • The DLL in the GAC had a different PublicKeyToken than what I expected. We had quite a few log4net assemblies hanging around, so I just needed to reference the correct one in my project. – gwin003 Apr 02 '14 at 20:35
  • Thanks :) I was wondering if there was some frig on the public key (we had the same issue) rather than hunting around for a DLL with an identical public key. We found and sorted eventually. – Program.X Apr 04 '14 at 16:49
0

Setting platform to x86 worked for me. Previous was AnyCPU

RonVibbentrop
  • 281
  • 4
  • 3
-1

Assuming that the dll is already in the application folder, go to the properties of the project, click on Application Files and change the dll from "prerequisite" to "include", and save it. It would then be in GAC.

HappyLee
  • 435
  • 4
  • 11
  • Its already in the GAC, as I said in my original question. I want to know WHY Crystal can't see it. – gwin003 May 21 '13 at 19:51