Skip to content

Commit 284e720

Browse files
Copilotbaronfel
andcommitted
Move PublishDir exclusion into main PropertyGroup with other output paths
Co-authored-by: baronfel <[email protected]>
1 parent b2ca669 commit 284e720

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ Copyright (c) .NET Foundation. All rights reserved.
3535
<DefaultItemExcludes>$(DefaultItemExcludes);$(BaseOutputPath)/**</DefaultItemExcludes>
3636
<!-- obj folder, by default -->
3737
<DefaultItemExcludes>$(DefaultItemExcludes);$(BaseIntermediateOutputPath)/**</DefaultItemExcludes>
38+
<!-- Exclude PublishDir to prevent published artifacts from being included in subsequent builds/publishes.
39+
This is especially important for file-based apps where PublishDir is set to ./artifacts/<appname> next to the app file. -->
40+
<DefaultItemExcludes Condition="'$(PublishDir)' != ''">$(DefaultItemExcludes);$(PublishDir)/**</DefaultItemExcludes>
3841

3942
<!-- Various files that should generally always be ignored -->
4043
<DefaultItemExcludes>$(DefaultItemExcludes);**/*.user</DefaultItemExcludes>
@@ -51,12 +54,6 @@ Copyright (c) .NET Foundation. All rights reserved.
5154
<DefaultExcludesInProjectFolder>$(DefaultExcludesInProjectFolder);$(DefaultItemExcludesInProjectFolder);**/.*/**</DefaultExcludesInProjectFolder>
5255
</PropertyGroup>
5356

54-
<!-- Exclude PublishDir to prevent published artifacts from being included in subsequent builds/publishes.
55-
This is especially important for file-based apps where PublishDir is set to ./artifacts/<appname> next to the app file. -->
56-
<PropertyGroup Condition="'$(PublishDir)' != ''">
57-
<DefaultItemExcludes>$(DefaultItemExcludes);$(PublishDir)/**</DefaultItemExcludes>
58-
</PropertyGroup>
59-
6057
<!-- Set the default versions of the NETStandard.Library or Microsoft.NETCore.App packages to reference.
6158
The implicit package references themselves are defined in Microsoft.NET.Sdk.props, so that they can be overridden
6259
in the project file. -->

0 commit comments

Comments
 (0)