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.

*.dll.config from package reference not copied to output on publish

See original GitHub issue

Description

It seems that the *.dll.config files from a package reference aren’t copied to the output directory during a dotnet publish.

Use case

I stumbled across this problem while consuming my FubarDev.PamSharp package, which requires having the ´.dll.configfile, because it contains adllmap` that is needed to find the correct native library.

dotnet --info

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview5-011568
 Commit:    b487ff10aa

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /home/fubar-coder/dotnet/sdk/3.0.100-preview5-011568/

Host (useful for support):
  Version: 3.0.0-preview5-27626-15
  Commit:  61f30f5a23

.NET Core SDKs installed:
  3.0.100-preview5-011568 [/home/fubar-coder/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.0.0-preview5-19227-01 [/home/fubar-coder/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.0.0-preview5-27626-15 [/home/fubar-coder/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

System information

Windows 10 Pro for Workstation 1809 (Build 17763.475)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
pfeiglcommented, Jul 22, 2020

We ran into the same problem. While I still think this is a actual bug (.config not copied along with the assembly when building, while this was promoted by Microsoft for many years), the following actually solves the problem in a kind of generic way.

  <ItemGroup>
    <None Include="App.config" 
           Pack="true" 
           PackagePath="contentFiles/any/any/$(TargetFileName).config"
           PackageCopyToOutput="true">
      <SubType>Designer</SubType>
    </None>
  </ItemGroup>
0reactions
sthames42commented, Apr 15, 2022

@pfeigl, your solution worked–thanks for that. But while the .dll.config file was copied to the bin folder of the consuming project, if that project is consumed by another, the config file is NOT copied to the parent bin folder even though the .dll and .pdb files are copied.

Any idea how to make it transitive.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuget package doesn't copy .dll.config files to output folder
I have an application that references this Nuget package. The assembly is correctly copied to the output folder, but the .dll.config is not....
Read more >
PackageReference in project files - NuGet
Package references, using <PackageReference> MSBuild items, specify NuGet package dependencies directly within project files, as opposed to ...
Read more >
How to copy dependent assemblies to the bin folder on build?
Solution · Open your project file. Simple enough, just select “Edit Project File” by clicking your project using the right mouse button in...
Read more >
Copy files from the NuGet package to the destination ...
But I have an issue with copying files to the module folder in the destination project when installing. It creates some references for...
Read more >
Microsoft assembly not copied to publish folder
DiagnosticSource package and ran a publish to File System and the DLL was in the published bin directory. This was using the packages.config...
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