Search code examples
debuggingnugetdebug-symbolscsproj

Nuget - command-line args with new csproj (to include symbols for debugging)


I would like to be able to debug one of my Nuget packages when using it in another project. In the past I would have added the '-sym' when running nuget.exe but I'm currently using the new csproj (so packaging is part of the build) and would like to be able to do the same thing. Anyone know how I can effectively do the this now that nuget.exe is a part of the build process.


Solution

  • The build tasks respect the msbuild properties IncludeSymbols and IncludeSource for including symbols and source.

    They are set when calling dotnet pack with --include-symbols and/or --include-source. For msbuild invocations, you'd set them like /p:IncludeSymbols=true.

    If your rely on the "generate packages on build" feature (which is based on the GeneratePackageOnBuild property), you could set these in your project file:

    <PropertyGroup>
      <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
      <IncludeSymbols>true</IncludeSymbols>
    </PropertyGroup>