Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Content Files in a Nuget package that refers another Nuget package

$
0
0

Context
I'm currently making multiple nuget packages that depend on each other. Each nuget package contains their own list of content files which should be copied to the output directory of the project that includes the package.

So lets say i have the following 2 packages

  • Base package
    • resource/contentFileBase.json
  • Utilities package
    • resource/contentFileUtilities.json
    • references the base package

In both projects csproj files i have defined the following entries for the content files

In base:

<Content Include="resource/contentFileBase.json">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      <PackageCopyToOutput>true</PackageCopyToOutput>
</Content>

In utilities:

<Content Include="resource/contentFileUtilities.json">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      <PackageCopyToOutput>true</PackageCopyToOutput>
</Content>

Now i package both the base package and the utilities package using dotnet pack. The resulting nuspec for the Utilities package will be generated:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>Utilities</id>
    <version>0.0.1</version>
    <dependencies>
      <group targetFramework=".NETCoreApp2.2">
        <dependency id="base" version="0.0.1" exclude="Build,Analyzers" />
      </group>
    </dependencies>
    <contentFiles>
      <files include="any/netcoreapp2.2/resources/contentFileUtilities.json" buildAction="Content" copyToOutput="true" />
      <files include="any/netcoreapp2.2/contentFileBase.json" buildAction="Content" />
    </contentFiles>
  </metadata>
</package>

The issue
As you see in the resulting nuspec file for the utilities package it includes the contentFileUtilities.json correctly as contentFile element. contentFileBase.json is also included in this nuspec with only the buildAction and notcopyToOutput. I wish the files from base are also copied to the output directory while only referencing the utilities package

Does anyone know how i can solve this problem?

Here is a demo project i created with the issue: https://github.com/Bramvanelderen10/nugetdemoi

Here a screenshot of the setup and the problem: enter image description here


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>