Error when installing window application

Posted on 2012-08-31
Medium Priority
Last Modified: 2012-09-05
Unable to install or run the application. The application
requires that assembly log4net Version be
installed in the Global Assembly Cache (GAC) first.
Question by:allelopath
  • 3
  • 2
  • 2
LVL 41

Expert Comment

by:Kyle Abrahams
ID: 38356120
find log4net.dll version

open %windir%\assembly

Drag the DLL onto the folder

Reinstall the application.
LVL 13

Assisted Solution

by:Norm Dickinson
Norm Dickinson earned 1000 total points
ID: 38356129
There should be a clue as to what needs to be installed and how to install it in the message, or in the documentation with the software you are trying to install. From what research I could find you may have installed the wrong version - 32 bit on a 64 bit machine or the other way around.

LVL 33

Expert Comment

by:Todd Gerbert
ID: 38356411
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.
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 41

Accepted Solution

Kyle Abrahams earned 1000 total points
ID: 38363837
tgerbert statement is incorrect.

The GAC is used to store assemblies.  You can actually have the same named assembly with a different version so that the correct version of the DLL is served up dependant on the application.

The installation dependency clearly states that the log4net.dll version NEEDS to be in the GAC before the installation can continue.  Since it is not there (otherwise this is an erroneous error message) it can be safely added without interfering with other applications.
LVL 13

Expert Comment

by:Norm Dickinson
ID: 38363921
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.
LVL 33

Expert Comment

by:Todd Gerbert
ID: 38369266
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 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.

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

Expert Comment

by:Todd Gerbert
ID: 38369269
Haha... That's what I get for demanding so much of my brain pre-coffee. ;)

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Screencast - Getting to Know the Pipeline
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question