You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently using a custom MSBuild target (AddHealthCheckSymbolsToSymbolPackage) to manually unzip the .snupkg file, add an extra PDB (from a referenced project), and re-zip the symbol package. This is needed because my NuGet package includes both mu88.Shared.dll and mu88.HealthCheck.dll, but only mu88.Shared.pdb is included by default in the symbol package.
<!-- To support proper Source Link debugging, we need to include the PDB files of all assemblies in the symbol package. --><!-- Since the NuGet package contains both mu88.Shared.dll and mu88.HealthCheck.dll, mu88.HealthCheck.pdb has to be added to the symbol package, too. --><!-- Unfortunately, I haven't found (yet) a better way of embedding the additional debug symbol file than manually manipulating the the package with custom MSBuild logic. -->
<TargetName="AddHealthCheckSymbolsToSymbolPackage"AfterTargets="Pack">
<PropertyGroup>
<TemporarySymbolPackageModificationDirectory>$(PackageOutputPath)temp</TemporarySymbolPackageModificationDirectory>
</PropertyGroup>
<ItemGroup>
<AdditionalDebugSymbolsInclude="$(OutputPath)/mu88.HealthCheck.pdb"/>
</ItemGroup>
<MessageText="Unzipping symbol package to '$(TemporarySymbolPackageModificationDirectory)'..."Importance="high" />
<UnzipSourceFiles="$(PackageOutputPath)/$(PackageId).$(Version).snupkg"DestinationFolder="$(TemporarySymbolPackageModificationDirectory)"OverwriteReadOnlyFiles="true"
/>
<MessageText="Deleting existing symbol package '$(PackageOutputPath)$(PackageId).$(Version).snupkg'..."Importance="high" />
<DeleteFiles="$(PackageOutputPath)$(PackageId).$(Version).snupkg" />
<MessageText="Adding additional debug symbols to '$(TemporarySymbolPackageModificationDirectory)/lib/$(TargetFramework)'..."Importance="high" />
<CopySourceFiles="@(AdditionalDebugSymbols)"DestinationFolder="$(TemporarySymbolPackageModificationDirectory)/lib/$(TargetFramework)"
/>
<MessageText="Repacking symbol package from '$(TemporarySymbolPackageModificationDirectory)' to '$(PackageOutputPath)$(PackageId).$(Version).snupkg'..."Importance="high" />
<ZipDirectorySourceDirectory="$(TemporarySymbolPackageModificationDirectory)"DestinationFile="$(PackageOutputPath)$(PackageId).$(Version).snupkg"Overwrite="true" />
<MessageText="Cleaning up temporary directory '$(TemporarySymbolPackageModificationDirectory)'..."Importance="high" />
<RemoveDirDirectories="$(TemporarySymbolPackageModificationDirectory)" />
</Target>
Is there a more idiomatic or supported way to include additional debug symbol files (PDBs) from referenced projects in the symbol package when running dotnet pack?
Ideally, I'd like to hook into an existing MSBuild target or use a built-in mechanism, rather than manipulating the package manually, e.g. something similar to <IncludeAssets>mu88.HealthChecker.dll</IncludeAssets> (taken from here).
Any advice or pointers to documentation would be appreciated! Thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently using a custom MSBuild target (
AddHealthCheckSymbolsToSymbolPackage
) to manually unzip the.snupkg
file, add an extra PDB (from a referenced project), and re-zip the symbol package. This is needed because my NuGet package includes bothmu88.Shared.dll
andmu88.HealthCheck.dll
, but onlymu88.Shared.pdb
is included by default in the symbol package.Excerpt from my
mu88.Shared.csproj
:Is there a more idiomatic or supported way to include additional debug symbol files (PDBs) from referenced projects in the symbol package when running
dotnet pack
?Ideally, I'd like to hook into an existing MSBuild target or use a built-in mechanism, rather than manipulating the package manually, e.g. something similar to
<IncludeAssets>mu88.HealthChecker.dll</IncludeAssets>
(taken from here).Any advice or pointers to documentation would be appreciated! Thanks!
Beta Was this translation helpful? Give feedback.
All reactions