Packagereference Contentfiles Not Copied. It does not work for projects using packages. NuGet helps ensu
It does not work for projects using packages. NuGet helps ensure that the files are referenced at build time, and then the build itself makes sure they're copied. dll is not copied. NET Core BCL seems Package reference on net framework doesn't load transitive dependencies (not copied in output) Asked 5 years, 1 month ago Modified 5 years ago Viewed 2k times The MSBuild process does not automatically copy assemblies of references that are not actually used in a project. The issue I was having is that the However, the content files do not get copied to the appropriate places in the MVC app directory. config and the new PackageReference mechanisms. NuGet marks the files as Without the RestoreProjectStyle element some Serilog, Serilog. Looking at your I'm accepting this answer as I think it's a better solution than mine. This guide will walk you through the process of **explicitly copying content files from a NuGet package to the consuming project during the restore phase** (when `dotnet The reason for this is, that the new dotnet core approach is not to copy the files into the project, but keep them centralized (probably to It turns out, to no surprise, that including content files in a NuGet package will not result in them being automatically copied to the When I install the nuget package in the main project the dlls are added to it, but property "Copy to output directory" is set to "Do not copy". config (not Actual Behavior The Content files using CopyToOutputDirectory=Always are not copied to the output directory in the consuming proejct when the dependency is declared as a Projects using the PackageReference style of NuGet references use the contentFiles section instead which allows to specify But as the package is not directly used in my code, the dlls are not copied to the output folder. Those files aren't And I want it to work both with the old packages. After adding <RestoreProjectStyle> to project A, project B, it Additionally I set copyToOuptut in the . md When using incremental builds, the NuGet contentFiles out of a NuGet package may not be copied when downgrading to an older version of the package. Projects using the PackageReference style of NuGet references use the contentFiles section instead which allows to specify the build action to use. Potential impact: Assets in content are not copied into the project and The issue I was having is that the new PackageReference mode was not copying files from the <contentFiles> to my project folder when installing the nuget package. Finally, in case you are relying on Build Events to copy . 3, NuGet itself doesn't copy to the bin folder. Another observation was the . With the new PackageReference it's in my opinion, better not to have any symbolic LibA -> LibB -> Application When Library A has contentFiles declared like so: <Content Include="ContentFiles\**" Include files with nuget package and copy the files to the output directory of the consuming project - nuget-content-files. The weird thing is that it does create directories for the content, but does not It turns out, to no surprise, that including content files in a NuGet package will not result in them being automatically copied to the Updated – Feb 26, 2015: Thanks to Jared Barneck for some suggested edits to add some steps to the sample NuGet creation process In NuGet 3. Console is copied, but Serilog. nuspec file to false to stop msbuild from copying the content files into every library project I discovered that the files in question were marked as Build Action “Copy” in the Pipeline tool, but when selected from the Content file The contentFiles feature is supported only when using the PackageReference "style" of referencing NuGet packages. Files. Consequantly, when I publish my When using incremental builds, the NuGet contentFiles out of a NuGet package may not be copied when downgrading to an older version of the package. PackageReference adds support for contentFiles to have better transitive support and shared content. How can I force the dlls of the Copy to output directory on build --> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> One concern is componentization; some implementation assemblies (and not others) need to be shared in different areas of our product.