Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,10 @@ Copyright (c) .NET Foundation. All rights reserved.
<ItemGroup>
<_ResolvedCopyLocalPublishAssets Include="@(ReferenceCopyLocalPaths)"
Exclude="@(_ResolvedCopyLocalBuildAssets);@(RuntimePackAsset)"
Condition="('$(PublishReferencesDocumentationFiles)' == 'true' or '%(ReferenceCopyLocalPaths.Extension)' != '.xml') and '%(ReferenceCopyLocalPaths.Private)' != 'false'">
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>
Comment on lines +706 to 711
Copy link

Copilot AI Jul 9, 2025

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.

Suggested change
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>

Copilot uses AI. Check for mistakes.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<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>
Copy link
Member

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.

</PropertyGroup>

<!-- Add a project capability so that the project properties in the IDE can show the option to generate an XML documentation file without specifying the filename -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,33 @@ public void It_publishes_referenced_assembly_documentation(string property, bool
}
}

[Theory]
[InlineData("PublishReferencesSymbols=false", false)]
[InlineData("PublishReferencesSymbols=true", true)]
public void It_publishes_referenced_project_symbol(string property, bool expectReferenceSymbol)
{
var kitchenSinkAsset = _testAssetsManager
.CopyTestAsset("KitchenSink", identifier: $"{property.Replace("=", "")}")
.WithSource();

var publishCommand = new PublishCommand(kitchenSinkAsset, "TestApp");
var publishArgs = new string[] { $"/p:{property}" };
var publishResult = publishCommand.Execute(publishArgs);

publishResult.Should().Pass();

var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: ToolsetInfo.CurrentTargetFramework);

if (expectReferenceSymbol)
{
publishDirectory.Should().HaveFile("TestLibrary.pdb");
}
else
{
publishDirectory.Should().NotHaveFile("TestLibrary.pdb");
}
}

private static JObject ReadJson(string path)
{
using (JsonTextReader jsonReader = new(File.OpenText(path)))
Expand Down