Stefan Radulian
Stefan Radulian

Reputation: 1436

"Copy Local" does not copy assemblies to output directory

I have an assembly X that is referencing System.Interactive and System.Reactive from a lib folder. Then I have assembly Y that is referencing X.

In X for both, System.Interactive and System.Reactive, 'Copy Local' is set to true. In Y for X 'Copy Local' is set to true. System.Reactive and System.Interactive are not in the GAC.

When I build Y, System.Interactive and System.Reactive are not copied to the output directory. Why?

Upvotes: 9

Views: 12551

Answers (3)

Pitka
Pitka

Reputation: 525

  1. add reference
  2. add link

Not any need to add reference into main project. 100% work and copy dlls to bin folder.

 <Reference Include="NM86">
      <HintPath>..\..\..\NM86.dll</HintPath>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      <SpecificVersion>False</SpecificVersion>
      <Private>True</Private>
    </Reference>
   <Content Include="..\..\..\NM86.dll">
      <Link>NM86.dll</Link>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      <SpecificVersion>False</SpecificVersion>
    </Content>

Upvotes: 3

Stefan Radulian
Stefan Radulian

Reputation: 1436

This seems to fix it: How does visual studio determine what to copy to the output directory with multi-project solutions?

I manually added True in .csproj to the reference to X in project Y and the assemblies were copied to the output directory.

Upvotes: 3

Marc Gravell
Marc Gravell

Reputation: 1063884

Y does not inherit "copy local" options from X. If you want System.Interactive and System.Reactive to be deployed with Y, then reference them both from Y, and in Y mark them as "Copy Local = true".

Upvotes: 4

Related Questions