NuGet/Home

PackTask quietly doesn't include files with nuspec extension in nupkg

Closed

#8637 opened on Sep 27, 2019

View on GitHub
 (4 comments) (1 reaction) (0 assignees)HTML (1,459 stars) (292 forks)batch import
Area:LoggingFunctionality:PackIcebox cleanup candidatePriority:3Product:NuGet.exeProduct:dotnet.exeStatus:Inactivehelp wanted

Description

Details about Problem

NuGet product used:

#> dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.0.100
 Commit:    04339c3a26

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18362
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100\

Host (useful for support):
  Version: 3.0.0
  Commit:  7d57652f33

.NET Core SDKs installed:
[...]
  3.0.100 [C:\Program Files\dotnet\sdk]

NuGet version: 5.3.0-rtm.6251+b75150f2f4127a77a166c9552845e86fb24a3282.b75150f2f4127a77a166c9552845e86fb24a3282

Worked before: Unknown.

Detailed repro steps

  1. Extract minimal repro project based on dotnet new classlib: PackNuspecContent.zip.

  2. dotnet pack

  3. Open obj\Debug\PackNuspecContent.1.0.0.nuspec, see the File items including a .nuspec:

    <file src="D:\temp\PackNuspecContent\targets\foo.nuspec" target="targets\foo.nuspec" />
    <file src="D:\temp\PackNuspecContent\targets\foo.nuspec.txt" target="targets\foo.nuspec.txt" />
    <file src="D:\temp\PackNuspecContent\targets\foo.txt" target="targets\foo.txt" />
    
  4. Open bin\Debug\PackNuspecContent.1.0.0.nupkg, open targets/, see that the .nuspec isn't included:

    ├───targets
    │       foo.nuspec.txt
    │       foo.txt
    

Other

My goal was to include a nuspec file in an MSBuild SDK tool package that the consuming project will use with nuget.exe pack. I don't think I'm blocked by this issue, but it's pretty surprising and took a bit to spot what was happening. 😄

Contributor guide