0

Project References dlls are copied on build to the root of output directory (if <Private>True</Private> is set for this reference at .csproj, or Copy Local is set to True at reference properties in VisualStudio)

I have NuGet-package dependency of some 3rd-party dll & want this dll to be copied to some subfolder of output dir on build. How can this be done?

PS: I've seen this question. But there is no answer appropriate for my case.

user1234567
  • 3,991
  • 3
  • 19
  • 25

1 Answers1

0

I didn't find better way, than just let them be coppied to output root & then move them to my subfolder by adding this instruction to .csproj:

  <!-- Move some dlls into /MySubfolder -->
  <PropertyGroup>
    <PrepareForRunDependsOn>$(PrepareForRunDependsOn);MyMoveDllsToOutputSubdir</PrepareForRunDependsOn>
  </PropertyGroup>
  <Target Name="MyMoveDllsToOutputSubdir">
    <Move SourceFiles="$(OutDir)\Aaa.dll;$(OutDir)\Aaa.pdb" DestinationFolder="$(OutDir)\MySubfolder" />
  </Target>
user1234567
  • 3,991
  • 3
  • 19
  • 25