Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pack an additional symbols.nupkg with new csproj VS2017

With the new csproj format in Visual Studio 2017, it makes it really easy to build nuget packages. If fact, in properties on the project file gives you a gui and you can enter all the nuget info so its just a click away to pack.

However there are no options in the gui to build a symbols.nupkg that includes the source and PDB for a nuget debugging server.

How can I use this new feature in VS2017 and still create a symbols.nupkg?

like image 753
jbtule Avatar asked Mar 22 '17 16:03

jbtule


People also ask

Should I include PDB files in NuGet package?

You shouldn't add pdb files to main nuget package.

What is symbols Nupkg?

The legacy symbol package format, . symbols. nupkg, can be pushed to the SymbolSource repository. Package consumers can then add https://nuget.smbsrc.net to their symbol sources in Visual Studio, which allows stepping into package code in the Visual Studio debugger. See Specify symbol (.

How do I use a Nupkg file?

Menu Tools → Options → Package Manager Click OK. Drop your NuGet package files in that folder. Go to your Project in Solution Explorer, right click and select "Manage NuGet Packages". Select your new package source.


2 Answers

Just edit your new csproj and inside the PropertyGroup tags add Tags for IncludeSource and IncludeSymbols like below. Pack in VS2017 will then make an additional symbols.nupkg.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    ...
    <IncludeSource>True</IncludeSource>
    <IncludeSymbols>True</IncludeSymbols>
  </PropertyGroup>
</Project>

To see the whole list of tags available for Nuget package building in the new csproj you can refer to the docs

like image 132
jbtule Avatar answered Sep 20 '22 01:09

jbtule


The accepted answer is valid because it's dated in Mar,2017.

Symbol packages is becoming legacy. symbols.nupkg is still supported but only for compatibility reasons.

The new recommended format for symbol packages is .snupkg Add the following lines in csproj file in vs 2017 :

   <PropertyGroup>
     <IncludeSymbols>true</IncludeSymbols>
     <SymbolPackageFormat>snupkg</SymbolPackageFormat>
   </PropertyGroup>

for more details review: https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg

like image 25
M.Hassan Avatar answered Sep 17 '22 01:09

M.Hassan