-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add the property controlling publishing the symbols of reference projects #49707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new PublishReferencesSymbols property to control publishing of referenced project PDB files, along with default behavior and tests.
- Added
PublishReferencesSymbolsproperty with a default value in MSBuild’s BeforeCommon targets. - Updated publish logic to conditionally include
.pdbfiles based on the new property. - Introduced a theory test to verify symbol publishing when the property is explicitly set.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAProjectWithDependencies.cs | Added a theory test for PublishReferencesSymbols=true/false scenarios. |
| src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets | Defined <PublishReferencesSymbols> property with a default of true. |
| src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets | Modified the copy-local asset condition to include .pdb when enabled. |
Comments suppressed due to low confidence (1)
test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAProjectWithDependencies.cs:280
- Consider adding a test case for the default behavior (when
PublishReferencesSymbolsisn't specified) to ensure it truly defaults totrueand PDB files are published by default.
[Theory]
| Condition="(('$(PublishReferencesDocumentationFiles)' == 'true' and '%(ReferenceCopyLocalPaths.Extension)' == '.xml') | ||
| or ('$(PublishReferencesSymbols)' == 'true' and '%(ReferenceCopyLocalPaths.Extension)' == '.pdb') | ||
| or ('%(ReferenceCopyLocalPaths.Extension)' != '.xml' and '%(ReferenceCopyLocalPaths.Extension)' != '.pdb')) | ||
| and '%(ReferenceCopyLocalPaths.Private)' != 'false'"> | ||
| <DestinationSubPath>%(ReferenceCopyLocalPaths.DestinationSubDirectory)%(ReferenceCopyLocalPaths.Filename)%(ReferenceCopyLocalPaths.Extension)</DestinationSubPath> | ||
| </_ResolvedCopyLocalPublishAssets> |
Copilot
AI
Jul 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] This multi-line Condition is quite verbose and can be hard to maintain; consider breaking it into separate ItemGroups or using intermediate properties to clarify each inclusion rule.
| Condition="(('$(PublishReferencesDocumentationFiles)' == 'true' and '%(ReferenceCopyLocalPaths.Extension)' == '.xml') | |
| or ('$(PublishReferencesSymbols)' == 'true' and '%(ReferenceCopyLocalPaths.Extension)' == '.pdb') | |
| or ('%(ReferenceCopyLocalPaths.Extension)' != '.xml' and '%(ReferenceCopyLocalPaths.Extension)' != '.pdb')) | |
| and '%(ReferenceCopyLocalPaths.Private)' != 'false'"> | |
| <DestinationSubPath>%(ReferenceCopyLocalPaths.DestinationSubDirectory)%(ReferenceCopyLocalPaths.Filename)%(ReferenceCopyLocalPaths.Extension)</DestinationSubPath> | |
| </_ResolvedCopyLocalPublishAssets> | |
| Condition="('$(PublishReferencesDocumentationFiles)' == 'true' and '%(ReferenceCopyLocalPaths.Extension)' == '.xml') or | |
| ('$(PublishReferencesSymbols)' == 'true' and '%(ReferenceCopyLocalPaths.Extension)' == '.pdb') or | |
| ('%(ReferenceCopyLocalPaths.Extension)' != '.xml' and '%(ReferenceCopyLocalPaths.Extension)' != '.pdb')"> | |
| </_ResolvedCopyLocalPublishAssets> | |
| <PropertyGroup> | |
| <IsDocumentationFile Condition="'$(PublishReferencesDocumentationFiles)' == 'true' and '%(ReferenceCopyLocalPaths.Extension)' == '.xml'">true</IsDocumentationFile> | |
| <IsSymbolFile Condition="'$(PublishReferencesSymbols)' == 'true' and '%(ReferenceCopyLocalPaths.Extension)' == '.pdb'">true</IsSymbolFile> | |
| <IsOtherFile Condition="'%(ReferenceCopyLocalPaths.Extension)' != '.xml' and '%(ReferenceCopyLocalPaths.Extension)' != '.pdb'">true</IsOtherFile> | |
| <IsPrivateFile Condition="'%(ReferenceCopyLocalPaths.Private)' != 'false'">true</IsPrivateFile> | |
| </PropertyGroup> | |
| <ItemGroup> | |
| <_ResolvedCopyLocalPublishAssets Include="@(ReferenceCopyLocalPaths)" | |
| Exclude="@(_ResolvedCopyLocalBuildAssets);@(RuntimePackAsset)" | |
| Condition="('$(IsDocumentationFile)' == 'true' or | |
| '$(IsSymbolFile)' == 'true' or | |
| '$(IsOtherFile)' == 'true') and | |
| '$(IsPrivateFile)' == 'true'"> | |
| <DestinationSubPath>%(ReferenceCopyLocalPaths.DestinationSubDirectory)%(ReferenceCopyLocalPaths.Filename)%(ReferenceCopyLocalPaths.Extension)</DestinationSubPath> | |
| </_ResolvedCopyLocalPublishAssets> | |
| </ItemGroup> | |
| <DestinationSubPath>%(ReferenceCopyLocalPaths.DestinationSubDirectory)%(ReferenceCopyLocalPaths.Filename)%(ReferenceCopyLocalPaths.Extension)</DestinationSubPath> | |
| </_ResolvedCopyLocalPublishAssets> |
|
@rainersigwald can you please take a look? |
|
@baronfel could you please check this PR? |
| <PublishDocumentationFiles Condition="'$(PublishDocumentationFiles)' == ''">true</PublishDocumentationFiles> | ||
| <PublishDocumentationFile Condition="'$(PublishDocumentationFile)' == '' and '$(PublishDocumentationFiles)' == 'true'">true</PublishDocumentationFile> | ||
| <PublishReferencesDocumentationFiles Condition="'$(PublishReferencesDocumentationFiles)' == '' and '$(PublishDocumentationFiles)' == 'true'">true</PublishReferencesDocumentationFiles> | ||
| <PublishReferencesSymbols Condition="'$(PublishReferencesSymbols)' == ''">true</PublishReferencesSymbols> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name seems fine to me given the other prior art.
|
I added the |
Please review the doc pr dotnet/docs#50255. |
Fix dotnet/msbuild#12044
Add the property
PublishReferenceSymbolsto control whether the .pdb file of the referenced project is published to the publish folder.