Skip to content

Behavior change for RAR Copy Local behavior when in the GAC #24

@AndyGerlicher

Description

@AndyGerlicher

This change request came from an external connect bug. Note the change is only when the Private tag ('Copy Local' in Visual Studio) is not present, which is the default. If this flag is given by the user it will still be honored in all cases.

Current Resolve Assembly Reference (RAR) behavior

  1. If the assembly is resolved and not found in the GAC, copy it.
  2. If the assembly is resolved from the GAC, don't copy the DLL.
  3. If the assembly is resolved locally and also happens to be present in the GAC, don't copy the DLL.

This behavior was intended to somewhat mimic run-time behavior. If an assembly is in the GAC on the build machine, it's assumed to be in the GAC on the target machine.

Proposed change in behavior

  1. If the assembly is resolved locally (not in the GAC) copy it. Regardless of if it's in the GAC or not.
  2. If the assembly is resolved through the GAC (wasn't found locally), then do not copy it.

Repro Steps

  1. Project1 references Project2 (Project Reference type)
  2. Project2 not in the GAC.
  3. Build

This yields the desired behavior, Project2.dll appears in the output folder.

However, if this test is repeated with Project2 in the GAC, Project2.dll will not be copied. The proposed fix would change this behavior and copy Project2.dll (since it was resolved locally first). This should also help when NuGet packages are referenced but also in the GAC on the build machine.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions