.NET Reference "Copy Local" True / Fasle Being Set Based on Contents of General Assembly

Posted by D-Sect on Stack Overflow See other posts from Stack Overflow or by D-Sect
Published on 2010-03-20T00:54:26Z Indexed on 2010/03/20 1:01 UTC
Read the original article Hit count: 507

Filed under:
|
|
|
|

Hello All. First question for me here.

We had a very interesting problem with a Win Forms project. It's been resolved. We know what happened, but we want to understand why it happened. This may help other people out in the future who have a similar problem.

The WinForms project failed on 2 of our client's PCs. The error was an obscure kernel.dll error. The project ran fine on 3 other PCs.

We found that a .DLL (log4net.dll - a very popular open-source logging library) was missing from our release folder. It was previously in our release folder. Why was it missing in this latest release?

It was missing because I must have installed a program on my Dev box that used log4net.dll and it was added to the general assembly.

When I checked the SLN's references for log4net.dll, they were changed to "copy local=FALSE". They must have changed automagicially because log4net.dll was present in my GAC.

Here's where my question starts:

Why did my reference for log4net.dll get changed from COPY LOCAL = TRUE to COPY LOCAL = FALSE? I suspect it's because it was added to my GAC by another program.

How can we prevent this from happening again? As it stands now, if I install a piece of software that uses a common library and it adds it to my GAC, then my SLNs that REF that DLL will change from Copy Local TRUE to FALSE.

Thank you so much. I hope this helps people out who have a piece of software that runs in some places, but not in others, when it used to run fine in ALL places.

© Stack Overflow or respective owner

Related posts about c#

Related posts about reference