Link to home
Start Free TrialLog in
Avatar of allelopath
allelopath

asked on

Error when installing window application

Unable to install or run the application. The application
requires that assembly log4net Version 1.2.10.0 be
installed in the Global Assembly Cache (GAC) first.
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

find log4net.dll version 1.2.10.0

open %windir%\assembly

Drag the DLL onto the folder

Reinstall the application.
SOLUTION
Avatar of Norm Dickinson
Norm Dickinson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You shouldn't really need to install anything into the Global Assembly Cache (GAC) - ever. Microsoft.Net was carefully, and intentionally, designed to allow side-by-side installations - meaning that mucking with the version of Log4Net in the GAC could potentially break other applications on the system that depend on it. In order to avoid such a situation dependent assemblies should be installed in your application's folder, not the GAC.

If your application, or the application in question, uses Log4Net then it's setup program or MSI installer should have put the appropriate Log4Net DLL's in it's folder.

Before playing with the GAC, try making sure that the correct version of the Log4Net DLL('s) are simply put into the same folder as the application.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Norm Dickinson
Norm Dickinson

As with any technical operation of this sort, the only safe or advised way to proceed is to do so with a good backup of all settings, files, and configurations so that you can reverse any changes if necessary.
Shoot, I clicked the "Preview" button instead of "Submit", hopefully no one's answered the question in the interim. ;)


You can actually have the same named assembly with a different version so that the correct version of the DLL is served up
That is true, but assumes the developer has correctly versioned their assemblies; and since Log4Net sources are freely distributed, it's entirely possible - likely, even - that there are more than one different Log4Net assemblies, with identical names and versions. Doing so also assumes that no other applications are depending on the ability to load a version of this assembly from the GAC with a weak name, in which case installing an assembly to the GAC would break those applications (and while it is rare, I have seen commercial developers mess this up). Further, it breaks your ability to do things along the lines of using an xcopy-type deployment, creating errors such as described by the askers question.


The installation dependency clearly states that the log4net.dll version 1.2.10.0 NEEDS to be in the GAC before the installation can continue.
If I recall correctly, that particular error message is displayed any time a ClickOnce application is deployed without all the necessary dependents - that is to say, the error message is slightly erroneous in that it's indicating an assembly can't be located, [i]not[/i] that it truly needs to be installed in the GAC. My personal experience with Log4Net reinforces this position, given each version of Log4Net I've used - or other applications I've installed that in turn use Log4Net - have done so with Log4Net assemblies in the application folder, [i]not[/i] in the GAC. Even Microsoft's position is basically that you shouldn't mess with the GAC unless absolutely necessary (see excerpts below, or MSDN for full documentation). Although installing the assembly to the GAC has relatively little risk associated with it, there is [i]zero[/i] risk associated with placing it in the application folder or correcting the deployment.

In my opinion, the [i]preferred[/i] way to resolve this particular problem is to correct the ClickOnce manifest so that it includes needed dependent assemblies (i.e. Log4Net should be included in the application's setup, not installed in the GAC separately); or, place the appropriate version of Log4Net.DLL in the application's folder. Only if that doesn't solve the problem, or if modifying the ClickOnce deployment is not an option, then install the DLL to the GAC.

msdn.microsoft.com/en-us/library/yf1d93sz(v=vs.100).aspx:
You should share assemblies by installing them into the global assembly cache only when you need to.
... keep assembly dependencies private, and [i]locate assemblies in the application directory[/i] ...
... it is not necessary to install assemblies into the global assembly cache to make them accessible to COM interop or unmanaged code.
Haha... That's what I get for demanding so much of my brain pre-coffee. ;)