Question

With a windows smart client application, it runs fine on my (development) machine, but when I installed it on a user's machine, I get this error:
Requires log4net version 1.2.10 be installed in GAC

On my development machine, I have 2 log4net files that are GACed: one x86, one 64 bit. The user machine has only the x86 version. So I guess the user needs the 64 bit, yes? If so, how do I install a 64 bit version of log4net?

Note that this is a different error than this: Error: Could not load log4net assembly

I've discovered another difference. If I publish in Development/Debug configuration, it works. If I publish in Release config, I get the error.

There seems to be no direct log4net references. It is use in either CrystalReports or NHibernate or both.

In Debug Configuration, the application is running as 32bit, in Release Configuration, the application is running as 64bit. If I could get the Release Configuration to run as 32bit, I think that would solve the problem. Can anyone say how that is done?

Was it helpful?

Solution

You can change the Release configuration to x86 in Visual Studio => Project properties => Compile => Advanced Compile options

OTHER TIPS

Check if you have Copy local=true on the log4net reference. If it is false the log4net has to be installed in the GAC, when it is true it is included in the application bin directory.

If you want to install it in the gac you can use gacutil to install the log4net.dll into the gac. Check if you application runs in 64bit (process explorer), if so, you need to install the 64bit version.

I faced similar issue with my ClickOnce application. I tried to put log4net dll in GAC and publish, but didn't work. It was also not related to 32/64 bit version as well.

The solution worked foe me is

  1. Remove and add log4net references in all the required projects from local folder.
  2. Check log4net reference properties and make sure property "CopyLocal=True" for all references. (In my case one of the referenced project was referring log4net with "CopyLocal=False" and thus looking for DLL in GAC)
  3. (For ClickOnce deploy applications) Remove and add referenced DLLs (which refer log4net) in the main project. This will force all the DLLs to be downloaded to client's machine again.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top