question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Broken Build]: Manually copied DLL to output directory not copied to depdendent project

See original GitHub issue

Issue Description

I manually copy a DLL from a NuGet package to the output directory in project A:

<Target Name="CopyNewestDllsToOutput" BeforeTargets="Build">
  <Copy SourceFiles="$(PkgMyPackage)\x64\My.dll" DestinationFolder="$(OutputPath)\Implementation" />
</Target>

Project B depends on project A, however, it does not receive this DLL as part of the output. How to fix this?

Best regards, D.R.

Steps to Reproduce

Expected Behavior

Actual Behavior

Ask us questions

Issue Analytics

  • State:closed
  • Created 2 months ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
drauchcommented, Jul 18, 2023

I’ve found a better solution thanks to a colleague of mine:

  <Content Include="$(PkgMyPackage)\x64\My.dll" CopyToOutputDirectory="PreserveNewest" />

This makes it work in all dependent projects as well and does not require me to reference the NuGet package in all projects again.

Best regards, D.R.

0reactions
drauchcommented, Jul 17, 2023

Then I’d first suggest making sure that it’s build/packed properly - so that ordinary PackageReference can be used.

Unfortunately, this is not going to happen 😕 I’ve worked around it by referencing the NuGet package in project A and project B (even though it should not be necessary in project B). Then the None-ItemGroup from above works as the $(PkgMyPackage) variable exists in both projects.

If anybody has a better solution I’ll gladly accept it 😃 For now: thanks @JanKrivanek for helping me out!

Best regards, D.R.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependent DLL is not getting copied to the build output ...
You can check this by selecting your project, then press ALT + ENTER , then select Application from left side and then select...
Read more >
Unnecessary dlls copied to output folder · Issue #2227
Consider the following solution where all projects use the new SDK (VS 15.6.7): Util: a DLL project targeting netstandard1.3 MyApp: an EXE ...
Read more >
Dependent DLL is not getting copied to the build output ...
The simple solution I encountered was to add the NuGet package to my MVC project. In one particular case this solved my problem....
Read more >
How to copy dependent assemblies to the bin folder on build?
Open your project file. Simple enough, just select “Edit Project File” by clicking your project using the right mouse button in the Solution ......
Read more >
Referenced dependencies not being copied to bin folder
The Problem: Rebuilding the project, only ClassLibrary1.dll is added to the output folder. Both file exists in the .nuget\packages\testing.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found