Skip to content

Commit ddcbc65

Browse files
committed
Merge remote-tracking branch 'upstream/release/10.0.2xx' into fbp-source-package
2 parents eb177e0 + ca56781 commit ddcbc65

File tree

4 files changed

+39
-6
lines changed

4 files changed

+39
-6
lines changed

eng/Version.Details.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ This file should be imported by eng/Versions.props
140140
<!-- dotnet/core-setup dependencies -->
141141
<NETStandardLibraryRefPackageVersion>2.1.0</NETStandardLibraryRefPackageVersion>
142142
<!-- microsoft/testfx dependencies -->
143-
<MicrosoftTestingPlatformPackageVersion>2.1.0-preview.25521.2</MicrosoftTestingPlatformPackageVersion>
144-
<MSTestPackageVersion>4.1.0-preview.25521.2</MSTestPackageVersion>
143+
<MicrosoftTestingPlatformPackageVersion>2.1.0-preview.25525.1</MicrosoftTestingPlatformPackageVersion>
144+
<MSTestPackageVersion>4.1.0-preview.25525.1</MSTestPackageVersion>
145145
</PropertyGroup>
146146
<!--Property group for alternate package version names-->
147147
<PropertyGroup>

eng/Version.Details.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,13 +553,13 @@
553553
<Uri>https://github.com/dotnet/dotnet</Uri>
554554
<Sha>79c85d969a02abd06c2202949318fd4c21e5e7a0</Sha>
555555
</Dependency>
556-
<Dependency Name="Microsoft.Testing.Platform" Version="2.1.0-preview.25521.2">
556+
<Dependency Name="Microsoft.Testing.Platform" Version="2.1.0-preview.25525.1">
557557
<Uri>https://github.com/microsoft/testfx</Uri>
558-
<Sha>c0c8cc1bc4a2d489279563def7b8ff830aa8160d</Sha>
558+
<Sha>82daaae2be64c7d3058a15656781bbf790e4e628</Sha>
559559
</Dependency>
560-
<Dependency Name="MSTest" Version="4.1.0-preview.25521.2">
560+
<Dependency Name="MSTest" Version="4.1.0-preview.25525.1">
561561
<Uri>https://github.com/microsoft/testfx</Uri>
562-
<Sha>c0c8cc1bc4a2d489279563def7b8ff830aa8160d</Sha>
562+
<Sha>82daaae2be64c7d3058a15656781bbf790e4e628</Sha>
563563
</Dependency>
564564
<Dependency Name="Microsoft.Extensions.Configuration.Ini" Version="10.0.0">
565565
<Uri>https://github.com/dotnet/dotnet</Uri>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ 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+
While in most cases PublishDir is contained within BaseOutputPath or BaseIntermediateOutputPath,
40+
this is by no means required, so we should protect against this happening here. -->
41+
<DefaultItemExcludes Condition="'$(PublishDir)' != ''">$(DefaultItemExcludes);$(PublishDir)/**</DefaultItemExcludes>
3842

3943
<!-- Various files that should generally always be ignored -->
4044
<DefaultItemExcludes>$(DefaultItemExcludes);**/*.user</DefaultItemExcludes>

test/Microsoft.NET.Build.Tests/GivenThereAreDefaultItems.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,35 @@ public void It_does_not_include_Windows_App_SDK_items_if_Windows_App_SDK_is_abse
854854
.BeEmpty();
855855
}
856856

857+
[Fact]
858+
public void It_excludes_items_in_publish_directory()
859+
{
860+
Action<GetValuesCommand> setup = getValuesCommand =>
861+
{
862+
// Create a PublishDir with a JSON file (simulating a previous publish)
863+
string publishDir = Path.Combine(getValuesCommand.ProjectRootPath, "artifacts", "TestLibrary");
864+
WriteFile(Path.Combine(publishDir, "appsettings.json"),
865+
"{ \"Setting\": \"Value\" }");
866+
867+
WriteFile(Path.Combine(getValuesCommand.ProjectRootPath, "Code", "Class1.cs"),
868+
"public class Class1 {}");
869+
};
870+
871+
Action<XDocument> projectChanges = project =>
872+
{
873+
var ns = project.Root.Name.Namespace;
874+
875+
var propertyGroup = new XElement(ns + "PropertyGroup");
876+
project.Root.Add(propertyGroup);
877+
propertyGroup.Add(new XElement(ns + "PublishDir", "artifacts\\TestLibrary\\"));
878+
};
879+
880+
var noneItems = GivenThatWeWantToBuildALibrary.GetValuesFromTestLibrary(Log, _testAssetsManager, "None", setup, projectChanges: projectChanges);
881+
882+
// The appsettings.json file in the PublishDir should not be included in None items
883+
noneItems.Should().NotContain(item => item.Contains("appsettings.json"));
884+
}
885+
857886
void RemoveGeneratedCompileItems(List<string> compileItems)
858887
{
859888
// Remove auto-generated compile items.

0 commit comments

Comments
 (0)