Debugging a release mode nuget package
- Ensure the .nupkg file contians the pdb file along with the dll.
a. From .NET 7 add this line to the CSPROJ in PropertyGroup element.<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
b. This line ensures the pdb file to be packed along with the dll in nupkg file.
c. Please googleHow to add pdb file in nupkg file in .NET x.x
for other .NET versions.
d. nuget#symbol-packages - In the project where you refer the package add below lines in the PropertyGroup.
a. msbuild-props<CopyDebugSymbolFilesFromPackages>true</CopyDebugSymbolFilesFromPackages> <CopyDocumentationFilesFromPackages>true</CopyDocumentationFilesFromPackages>
Directory.Build.props
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<LangVersion>preview</LangVersion>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<CopyDebugSymbolFilesFromPackages>true</CopyDebugSymbolFilesFromPackages>
<CopyDocumentationFilesFromPackages>true</CopyDocumentationFilesFromPackages>
</PropertyGroup>
Pushing a package to private nuget feed.
dotnet nuget push --source "<nuget url?" --api-key az <package path> --interactive