Craig
Craig

Reputation: 445

Unable to include .pdb files in NuGet package

I'm trying to include the .pdb files in my NuGet packages to assist with debugging, but I can't seem to get it to work. I've added the following line to my .csproj file as recommended. It's in the same PropertyGroup as AssemblyName, OutputType, TargetFrameworkVersion, etc.

<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>

I'm using:

And have the following post build event:

nuget pack $(ProjectPath) -Prop Configuration=$(ConfigurationName)
nuget add $(ProjectName).@(VersionNumber).nupkg -source %PACKAGES_FOLDER%

I was using a nuspec file to get them in there, but this was messing with our build server.

All help appreciated.

Cheers Craig

Upvotes: 2

Views: 2403

Answers (1)

Craig
Craig

Reputation: 445

Okay. I finally sorted out my NuGet issues. The following info may help others.

  • I placed the latest version of nuget.exe in my solution folder.
  • I don't have any nuspec files. This keeps our build server happy.
  • I removed the AllowedOutputExtensionsInPackageBuildOutputFolder setting from my .csproj files. This only appears to work for .NET Core and .NET Standard projects. I confirmed this by creating three brand new VS 2017 projects. The .NET Framework project was the only one that wouldn't pack (tested using dotnet pack instead of nuget pack).

I'm now using the following post build event in each of my projects:

del "$(ProjectDir)$(OutDir)*.nupkg"
$(SolutionDir)nuget pack $(ProjectPath) -symbols -Prop Configuration=$(ConfigurationName)
$(SolutionDir)nuget add $(ProjectName).@(VersionNumber).symbols.nupkg -source C:\Packages

The first line just removes previously generated .nupkg files that pile up in the build folder.

Upvotes: 1

Related Questions