Creating a package with .snupkg symbols fails with error NU5005
See original GitHub issueRepro steps
- Create the following project:
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<Import Project=".paket\Paket.Restore.targets" />
</Project>
-
paket convert-from-nuget
. -
dotnet pack
Expected behavior
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.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:16 (9 by maintainers)
Top Results From Across the Web
NuGet Error NU5005
Solution. When building a symbols package, ensure that the folder containing the nuspec file contains assembly files for which the symbols need ...
Read more >Creating symbol packages (.snupkg) - NuGet
How to create NuGet symbol packages (snupkg). ... If a package fails a validation check, its package details page will display an error...
Read more >c# - How to package and deploy a NuGet ...
I have created a very simple NuGet package from a .net framework visual studio Class Library project, where the class library source is...
Read more >Exclude authors from valid metadata check when ...
Error NU5005 : Failed to build package. Ensure '/Users/rad/projects/temp/nuget/hello2/Package.nuspec' includes source and symbol files. For help on building ...
Read more >Untitled
Author ruban abrasif Creating a package with .snupkg symbols fails with error NU5005 … WebJul 19, 2022 · Nuget.Core 1.0.1120.104 MyNuGet NuGet.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 pack
I 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.nuspec
file 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.props
which enables this:This workaround will not work for .NET Framework projects, because
dotnet pack
doesn’t work, at least as far as I can tell.