Search code examples
nugetchocolatey

How to add additional files to a package using NuGet?


Attempt

Nuspec

<files>
  <file src="https://raw.githubusercontent.com/030/chocolateyautomatic/master/common/Uninstall-ChocolateyZipPackage030.ps1" target="tools" />
</files>

Result

File is not added to tools directory


Running cpack indicates the following:

Calling 'C:\ProgramData\Chocolatey\chocolateyinstall\nuget.exe pack  -NoPackageAnalysis
Attempting to build package from 'eclipse.nuspec'.
The given path's format is not supported.

Attempt two

  <files>
    <file src="path\to\chocolateyautomatic\common\Uninstall-ChocolateyZipPackage030.ps1" target="tools\Uninstall-ChocolateyZipPackage030.ps1" />
  </files>

Result Two

The The given path's format is not supported. issue has been disappeared, but the Uninstall-ChocolateyZipPackage030.ps1 file is not added to the tools directory.


Solution

  •   <files>
        <file src="..\..\..\common\Uninstall-ChocolateyZipPackage030.ps1" target="tools\Uninstall-ChocolateyZipPackage030.ps1" />
        <file src="tools\*" target="tools" />
      </files>
    

    adds all the files to the nupkg file.