Skip to content

Commit 1f42899

Browse files
CopilotMalcolmnixon
andcommitted
Group package dependencies into separate ItemGroup sections
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
1 parent 1e48697 commit 1f42899

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

src/DemaConsulting.TemplateDotNetTool/DemaConsulting.TemplateDotNetTool.csproj

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,25 @@
4646
<SBOMPackageSupplier>Organization: $(Company)</SBOMPackageSupplier>
4747
</PropertyGroup>
4848

49+
<!-- Runtime Dependencies -->
4950
<ItemGroup>
5051
<PackageReference Include="DemaConsulting.TestResults" Version="1.5.0" />
51-
<!-- PrivateAssets="All" prevents these build-time-only packages from becoming transitive dependencies -->
52+
</ItemGroup>
53+
54+
<!-- Build Tool Dependencies -->
55+
<ItemGroup>
5256
<PackageReference Include="Microsoft.Sbom.Targets" Version="4.1.5" PrivateAssets="All" />
5357
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.103" PrivateAssets="All" />
54-
<!--
55-
Analyzer and source-only packages require both PrivateAssets and IncludeAssets:
56-
PrivateAssets="all" - prevents these build-time assets from flowing to consumers
57-
IncludeAssets - explicitly enables contentfiles (source injection) and
58-
analyzers/buildtransitive (Roslyn analyzers at compile time)
59-
-->
58+
<PackageReference Include="Polyfill" Version="9.12.0" PrivateAssets="All" />
59+
</ItemGroup>
60+
61+
<!-- Code Analysis Dependencies -->
62+
<ItemGroup>
63+
<!-- Analyzer packages use child-element form to configure both PrivateAssets and IncludeAssets:
64+
- PrivateAssets="all" prevents these build-time analyzers from becoming transitive dependencies
65+
in packages that consume this tool.
66+
- IncludeAssets lists all asset types (including 'analyzers' and 'buildtransitive') to ensure
67+
Roslyn analyzers and MSBuild targets are fully activated during the build. -->
6068
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="10.0.103">
6169
<PrivateAssets>all</PrivateAssets>
6270
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -65,11 +73,6 @@
6573
<PrivateAssets>all</PrivateAssets>
6674
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
6775
</PackageReference>
68-
<!-- Polyfill is a source-only package; contentfiles delivers the polyfill source into this project -->
69-
<PackageReference Include="Polyfill" Version="9.12.0">
70-
<PrivateAssets>all</PrivateAssets>
71-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
72-
</PackageReference>
7376
</ItemGroup>
7477

7578
<ItemGroup>

test/DemaConsulting.TemplateDotNetTool.Tests/DemaConsulting.TemplateDotNetTool.Tests.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525

2626
<!-- Test Framework Dependencies -->
2727
<ItemGroup>
28+
<!-- coverlet.collector uses child-element form to configure both PrivateAssets and IncludeAssets:
29+
- PrivateAssets="all" keeps this test-coverage tool out of any consuming project's dependencies.
30+
- IncludeAssets lists all asset types (including 'build' and 'buildtransitive') to ensure the
31+
data collector MSBuild targets are activated so coverage is collected during test runs. -->
2832
<PackageReference Include="coverlet.collector" Version="8.0.0">
2933
<PrivateAssets>all</PrivateAssets>
3034
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -36,6 +40,11 @@
3640

3741
<!-- Code Analysis Dependencies -->
3842
<ItemGroup>
43+
<!-- Analyzer packages use child-element form to configure both PrivateAssets and IncludeAssets:
44+
- PrivateAssets="all" prevents these build-time analyzers from becoming transitive dependencies
45+
in any project that references this test project.
46+
- IncludeAssets lists all asset types (including 'analyzers' and 'buildtransitive') to ensure
47+
Roslyn analyzers and MSBuild targets are fully activated during the build. -->
3948
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="10.0.103">
4049
<PrivateAssets>all</PrivateAssets>
4150
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

0 commit comments

Comments
 (0)