views:

606

answers:

3

I am using w7, 64bit and vs.net 2010.

I am adding a reference to a component that is within my 'add references' dialog box. The component is a 3rd party dll.

Historically, on w7 32bit it would add a line in my web.config (within the assemblies tag) referencing this dll and it wouldn't copy the dll to the bin directory.

However, on 64bit w7 the dll is copied to the bin directory and the web.config is not updated at all.

Why is the dll being copied to the bin directory? thanks

Solution: (Updated) These posts gave me the clues I needed.

VS.NET will copy the dll to the bin directory if your system cannot find the dll in the GAC. Assemblies in the GAC (registered on your workstation) and can be found by looking at C:\Windows\Assembly directory.

Components listed in vs.net ‘add references dialog’ may or may not be in the gac. Because the component is listed in the ‘add references’ dialog doesn't imply it is registered on your local workstation. I navigated to the component directory and dragged the desired dll’s to the C:\Windows\Assembly directory. I closed and re-opened vs.net and browsed to the same file(s) and clicked add reference.

This added the assembly reference to my web.config (and it also didn’t copy the dll to my web site bin directory)**

+7  A: 

On the reference, there is a Copy Local property (in the Properties window), which determines whether the assembly should be copied to the output directory.

As to why that might not have mattered for other references, MSDN says:

If you deploy/copy an application that contains a reference to a custom component that is registered in the GAC, the component will not be deployed/copied with the application, regardless of the Copy Local setting.

bdukes
Within vs.net 2010, this is a web site (and not a web application) and so there isn't a references folder within the solution. I just have a bin directory and if I look at the properties of the dll i just have "auto-refresh path", "file name", and "Full Path" properties. I don't have the property "copy local".
David
@David If you add the `<assembly>` entry to the web.config and delete the DLL, does your site function properly?
bdukes
+4  A: 

It gets copies to the bin directory so that the executable can find it. It won't find it otherwise, unless the dll is installed in the GAC.

Russ
The dll is within the gac (as it does show up in the 'add references' dialog window) so i would expect that it not copy the dll
David
+1, this answer is correct. The Add Reference dialog has *nothing* to do with the GAC. It only lists registered reference assemblies, it never lists anything from the GAC directories.
Hans Passant
+1  A: 

Additionally to previous responses : I think that Visual Studio determines if the Copy Local property is set to true based on the fact that the DLL is not in your computer GAC.
It prevents the VS to copy the native .net DLLs, so it should by default only copy "custom" DLLs.

Julien N
This is an asp.net "Web Site" not a "Web Application" and I am unable to change copy local property. In addition, the component is within the gac so it should just be adding a reference to it within the web.config. Not sure why, would this be related to this be w7 64 bit workstation?
David
Julien N