2

I have two solutions, Foo and Bar.

One of the projects in Foo, Foo.A, outputs a nuget package, which our build server pushes to an internal nuget feed. One of the projects in Bar, Bar.A, references this nuget package.

Foo.A contains a config file, which I want to have copied to the bin output folder of Bar.A upon build. To accomplish this, I've come up with the following nuspec:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>Foo.A</id>
    <!-- rest of metadata omitted -->
    <contentFiles>
      <files include="Config/*.config" buildAction="None" copyToOutput="true" flatten="false" />
    </contentFiles>
  </metadata>

  <files>
    <file src="bin\$Configuration$\*.dll" target="lib" />
    <file src="bin\$Configuration$\*.pdb" target="lib" />
    <file src="Config\*.config" target="lib\Config" />
  </files>
</package>

This creates a package with an internal structure like this:

Foo.A.nupkg
|-- lib
|    |-- Config
|    |    +-- Foo.A.config
|    |-- Foo.A.dll
|    +-- Foo.A.pdb
+-- Foo.A.nuspec

where the metadata section in the nuspec above is preserved in Foo.A.nuspec, but the files section is gone.

When I import this package in Bar.A and build, I get the dll and pdb file from Foo.A copied to the bin folder, but not the Config directory.

I've read the relevant sections of the nuspec reference a couple of times, but I'm not getting any wiser.

What do I need to do to get this working?

Tomas Aschan
  • 58,548
  • 56
  • 243
  • 402

0 Answers0