You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Creating a package with .snupkg symbols fails with error NU5005 #3685
A .snupkg file would be created alongside with its main .nupkg package file.
Actual behavior
C:\Users\teots\code\paket-bug\.paket\Paket.Restore.targets(304,5): error NU5005: Failed to build package. Ensure 'C:\Users\teots\code\paket-bug\obj\Debug\paket-bug.1.0.0.nuspec' includes source and symbol files. For help on building symbols package, visit https://docs.nuget.org/. [C:\Users\teots\code\paket-bug\paket-bug.csproj]
Additional information
I saw a paket-bug.1.0.0.symbols.nuspec file inside obj/Debug. Was Paket trying to create a legacy .symbols.nupkg file? Maybe my previous fix in #3636 was not enough.
With net5 and with putting <PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.0.0" PrivateAssets="All" />
into a Directory.Build.props file (so it doesn't interfere with paket) and removing this dependency from paket altogether, it works for me now.
@atlemann sorry for the late answer, but yes, that's what I do.
meanwhile I've made changes (because I want to create one nuget with all projectreferences inside instead of each projectreference as a separate nuget), and now it looks like this:
in the .csproj of the project that gets packed as a nuget:
In paket.dependencies and paket.references no mention of either Microsoft.SourceLink.AzureRepos.Gitor NuGetizer.
And it works perfectly:
I get a single nuget that contains the referenced projects instead of referencing them as nuget dependencies (but of course still references any external nuget dependencies as such)
I can view the source in an app consuming this nuget
all this being said, I'd still prefer a lot, if I could handle everything with paket, so also these two packages.
But on the other hand, I'm also not quite surprised that they require special handling. This is the one fundamental issue with paket: while it is still the far superior nuget client, in my opinion, even though the regular one by now handles transitive dependencies correctly, it will always suffer from being 3rd party - certain very nuget-intrinsics specific integrations like sourcelink/debug symbols or manipulation of the packaging like NuGetizer will be built by people not even aware of paket.
The best outcome really would be if paket's concepts were merged into the mainstream nuget mechanism, but I'm not holding my breath...
Trying to look into how this all works. When IncludeSymbols is defined, a .nuspec and a separate .symbols.nuspec file iscreated, but it seems that to make a nupkg and a snupkg file, both the .dll's and the .pdb's should be listed in the same .nuspec file. If I copy all files references from both .nuspec files into a single one and use that in the PackTask, I get the two packages, nupkg with .dll and .xml if generated, and a snupkg with .pdb files.
Hmm, when I run dotnet pack on a similar project which doesn't use Paket, I get a .nuspec and a .symbols.nuspec in the obj folder. So I guess that's correct. So, I guess some tricks must be done in Paket.Restore.targets to make this work.
I have no clue how this works with vanilla dotnet nuget, but when using the PackTask, specifying a .nuspec with all files including .pdb's is the only way I could make it create both packages.
But when doing dotnet pack I get the following error:
/home/atle/src/MyNuget/.paket/Paket.Restore.targets(317,5): error NU5005: Failed to build package. Ensure '/home/atle/src/MyNuget/src/MyFsNuget/obj/Debug/MyFsNuget.1.0.0.nuspec' includes source and symbol files. For help on building symbols package, visit https://docs.nuget.org/. [/home/atle/src/MyNuget/src/MyFsNuget/MyFsNuget.fsproj]
In order to make a .nupkg with a separate .snupkg for SourceLink, the .nuspec file should contain paths to both *.dll and *.pdb (and *.xml if you want docs). So if you create a .nuspec file with that you can do
and both packages will be created. However, to avoid manually creating the .nuspec file, just add the following line to the project to add the .pdb files to the .nuspec created by dotnet.
This issue's root cause matches #3272, which was fixed in commit 4f7e1f0 (merged via PR #4367): when IncludeSymbols/IncludeSource is set, the SDK's GenerateNuspec target produces both a regular .nuspec and a .symbols.nuspec. PaketOverrideNuspec's glob previously matched both, and MSBuild joined them with ; into a single NuspecFileAbsolutePath, producing an invalid combined path that PackTask/NuGet rejected (as "syntax is incorrect" or, in this case, NU5005 because the resulting nuspec was malformed/incomplete).
The fix adds a _PrimaryNuspecFile item that excludes *.symbols.nuspec, using only the primary nuspec for NuspecFileAbsolutePath while fix-nuspecs still processes all nuspec files.
If you're still hitting this error on a build newer than that commit, please reopen with your exact paket --version and a minimal repro — otherwise I'd recommend closing this as a duplicate of #3272 (fixed).
Generated by 🌈 Repo Assist, see workflow run. Learn more. Comment /repo-assist to run again
Add this agentic workflow to your repo
To install this agentic workflow, run
gh aw add githubnext/agentics/workflows/repo-assist.md@ae8d551f07c7ed7619f8c58c7bb4c3ac89395d38
Activity
ModernRonin commentedon Oct 17, 2020
I hit the same problem. Is there any workaround I can use until this is fixed?
atlemann commentedon Dec 4, 2020
I'm also getting the same issue. Not sure how to work around it. Tried with dotnet SDK 5.0.100 as well, but no luck'
ModernRonin commentedon Dec 4, 2020
With net5 and with putting
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.0.0" PrivateAssets="All" />into a
Directory.Build.propsfile (so it doesn't interfere with paket) and removing this dependency from paket altogether, it works for me now.maybe something to try @atlemann
atlemann commentedon Dec 4, 2020
Ah thanks @ModernRonin I'll try that.
atlemann commentedon Dec 4, 2020
Still doesn't work. Once I add
<IncludeSymbols>true</IncludeSymbols>anywhere, it fails with the same error.ModernRonin commentedon Dec 4, 2020
Hmm, strange. Maybe some of the following helps?
in my
Directory.Build.Props:my paket version is: 5.257.0 and I'm using net5, like you.
atlemann commentedon Dec 4, 2020
Ok, looks like you are embedding the .pdb file in the NuGet package with the assemblies instead of creating a separate symbols NuGet package?
ModernRonin commentedon Dec 7, 2020
@atlemann sorry for the late answer, but yes, that's what I do.
meanwhile I've made changes (because I want to create one nuget with all projectreferences inside instead of each projectreference as a separate nuget), and now it looks like this:
in the .csproj of the project that gets packed as a nuget:
In directory.build.props at the solution level:
In paket.dependencies and paket.references no mention of either
Microsoft.SourceLink.AzureRepos.GitorNuGetizer.And it works perfectly:
ModernRonin commentedon Dec 7, 2020
of course, this all is skewed towards in-house usage. If you're aiming to publish a public nuget, this is maybe not ideal for you.
ModernRonin commentedon Dec 7, 2020
all this being said, I'd still prefer a lot, if I could handle everything with paket, so also these two packages.
But on the other hand, I'm also not quite surprised that they require special handling. This is the one fundamental issue with paket: while it is still the far superior nuget client, in my opinion, even though the regular one by now handles transitive dependencies correctly, it will always suffer from being 3rd party - certain very nuget-intrinsics specific integrations like sourcelink/debug symbols or manipulation of the packaging like NuGetizer will be built by people not even aware of paket.
The best outcome really would be if paket's concepts were merged into the mainstream nuget mechanism, but I'm not holding my breath...
atlemann commentedon Dec 7, 2020
Trying to look into how this all works. When IncludeSymbols is defined, a .nuspec and a separate .symbols.nuspec file iscreated, but it seems that to make a nupkg and a snupkg file, both the .dll's and the .pdb's should be listed in the same .nuspec file. If I copy all files references from both .nuspec files into a single one and use that in the PackTask, I get the two packages, nupkg with .dll and .xml if generated, and a snupkg with .pdb files.
atlemann commentedon Dec 7, 2020
Hmm, when I run
dotnet packon a similar project which doesn't use Paket, I get a .nuspec and a .symbols.nuspec in the obj folder. So I guess that's correct. So, I guess some tricks must be done in Paket.Restore.targets to make this work.atlemann commentedon Dec 7, 2020
hmm, seems like completely removing
PaketOverrideNuspectarget just works, but then paket fix-nugets won't be run anymore which is a problem.atlemann commentedon Dec 7, 2020
I have no clue how this works with vanilla dotnet nuget, but when using the PackTask, specifying a .nuspec with all files including .pdb's is the only way I could make it create both packages.
It's not completely clear in the docs if it should be two separate nuspec files or just a single one: https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg#symbol-package-structure
atlemann commentedon Dec 14, 2020
After some trial and error I found out how to make separate .nupkg and .snypkg packages with Paket.
According to the .NET docks, to create a separate symbols package, add the following to the project file:
But when doing
dotnet packI get the following error:In order to make a .nupkg with a separate .snupkg for SourceLink, the .nuspec file should contain paths to both *.dll and *.pdb (and *.xml if you want docs). So if you create a .nuspec file with that you can do
and both packages will be created. However, to avoid manually creating the .nuspec file, just add the following line to the project to add the .pdb files to the .nuspec created by dotnet.
Now when you do:
you can see the .pdb files being added to the
path/to/MyProject/obj/Debug/MyProject.x.y.z.nuspecfile and two separate packages will be built.Note that the two separate packages will only be built if you have the
options. If not, the .pdb files will be added to the .nupgk package.
So this is an examlpe
Directory.Build.propswhich enables this:kroppt commentedon Jan 26, 2021
This workaround will not work for .NET Framework projects, because
dotnet packdoesn't work, at least as far as I can tell.Apply workaround from fsprojects/Paket#3685 (comment)
Apply workaround from fsprojects/Paket#3685 (comment)
Merge pull request #52 from gdziadkiewicz/Fix-build
github-actions commentedon Aug 29, 2026
🤖 This is an automated response from Repo Assist.
This issue's root cause matches #3272, which was fixed in commit 4f7e1f0 (merged via PR #4367): when
IncludeSymbols/IncludeSourceis set, the SDK'sGenerateNuspectarget produces both a regular.nuspecand a.symbols.nuspec.PaketOverrideNuspec's glob previously matched both, and MSBuild joined them with;into a singleNuspecFileAbsolutePath, producing an invalid combined path that PackTask/NuGet rejected (as "syntax is incorrect" or, in this case, NU5005 because the resulting nuspec was malformed/incomplete).The fix adds a
_PrimaryNuspecFileitem that excludes*.symbols.nuspec, using only the primary nuspec forNuspecFileAbsolutePathwhilefix-nuspecsstill processes all nuspec files.If you're still hitting this error on a build newer than that commit, please reopen with your exact
paket --versionand a minimal repro — otherwise I'd recommend closing this as a duplicate of #3272 (fixed).Add this agentic workflow to your repo
To install this agentic workflow, run