jbtule
jbtule

Reputation: 31799

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?

Upvotes: 17

Views: 4187

Answers (2)

M.Hassan
M.Hassan

Reputation: 11092

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://learn.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg

Upvotes: 3

jbtule
jbtule

Reputation: 31799

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

Upvotes: 27

Related Questions