Is it possible to copy contentFiles to executable project's output only? #9627
Labels
Area:ContentFiles
PackageReference contentFiles folder
Functionality:Restore
Resolution:Duplicate
This issue appears to be a Duplicate of another issue
Type:Feature
Let's assume I have the following project structure:
The NuGet package contains some assets which are required by Library B at runtime.
The nuspec file for the package looks like this:
This setup actually works. The assets will be copied to the executable project's output path on build.
the problem
The assets will not only be copied to the ExecutableProject's output path, but also to the output paths of Project A and Project B.
This is a problem in case there are a lot of nuget packages, there are a lot of asset files and the project dependency graph is deep, because it increases the build time.
Is it possible to build the nuget package in a way so that the contentFiles are copied to executable project's output only?
I'm thinking of a behavior like runtime files, but I want to be able to include any file (not just assemblies) and keep the folder hierarchy.
I have tried different combinations of buildAction, copyToOutput and PrivateAssets (in Project B) but I couldn't get it to work.
Either the assets are copied to all related project's output paths, or the assets aren't copied at all.
Is the scenario I describe supported by NuGet?
demo project
I have built a small projects which demonstrates the problem:
nuget-issue-demo.zip
tools versions
nuget.exe: 5.6.0.6591
dotnet.exe: 3.1.201
Visual Studio: 16.5.4
The text was updated successfully, but these errors were encountered: