Skip to content

Commit 28c42cc

Browse files
Enable .net10.0 tests (#650)
1 parent 5bfc41b commit 28c42cc

File tree

7 files changed

+43
-1059
lines changed

7 files changed

+43
-1059
lines changed

Directory.Packages.props

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
55
<!-- Please use caution adding a dependency to MSBuild packages. Use latest for testing and
66
use the minimum version for compilation for back compat. -->
7-
<MicrosoftBuildPackageVersion>17.14.28</MicrosoftBuildPackageVersion>
7+
<MicrosoftBuildPackageVersion>18.0.2</MicrosoftBuildPackageVersion>
88
<MicrosoftBuildPackageNet8>17.11.48</MicrosoftBuildPackageNet8>
9+
<MicrosoftBuildPackageNet9>17.14.28</MicrosoftBuildPackageNet9>
910
</PropertyGroup>
1011

1112
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0' Or '$(TargetFramework)' == 'netstandard2.0'">
@@ -18,12 +19,21 @@
1819
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="8.0.0" />
1920
</ItemGroup>
2021

21-
<ItemGroup Condition="'$(TargetFramework)' != 'net8.0' And '$(TargetFramework)' != 'netstandard2.0'"> <!-- And '$(TargetFramework)' != 'net472'">-->
22+
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
23+
<PackageVersion Include="Microsoft.Build" Version="$(MicrosoftBuildPackageNet9)" />
24+
<PackageVersion Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildPackageNet9)" />
25+
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildPackageNet9)" />
26+
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildPackageNet9)" />
27+
<PackageVersion Include="System.Text.Json" Version="9.0.0" />
28+
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.0" />
29+
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="9.0.0" />
30+
</ItemGroup>
31+
32+
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0' Or '$(TargetFramework)' == 'net472'">
2233
<PackageVersion Include="Microsoft.Build" Version="$(MicrosoftBuildPackageVersion)" />
2334
<PackageVersion Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildPackageVersion)" />
2435
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildPackageVersion)" />
2536
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildPackageVersion)" />
26-
2737
<PackageVersion Include="System.Text.Json" Version="9.0.0" />
2838
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.0" />
2939
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="9.0.0" />
@@ -57,7 +67,7 @@
5767
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
5868
<PackageVersion Include="AssemblyShader" Version="1.1.3" />
5969
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
60-
<PackageVersion Include="MSBuild.ProjectCreation" Version="16.1.0" />
70+
<PackageVersion Include="MSBuild.ProjectCreation" Version="17.0.1" />
6171
<PackageVersion Include="Shouldly" Version="4.2.1" />
6272
<PackageVersion Include="xunit" Version="2.9.3" />
6373
<PackageVersion Include="xunit.analyzers" Version="1.25.0" />

azure-pipelines.yml

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,13 @@ jobs:
8383
testRunTitle: 'Windows .NET 9.0'
8484
condition: succeededOrFailed()
8585

86-
# Disabled due to MSBuild.ProjectCreation dependency issue
87-
# - task: DotNetCoreCLI@2
88-
# displayName: 'Run Unit Tests (.NET 10.0)'
89-
# inputs:
90-
# command: 'test'
91-
# arguments: '--no-restore --no-build --framework net10.0 /noautorsp'
92-
# testRunTitle: 'Windows .NET 10.0'
93-
# condition: succeededOrFailed()
86+
- task: DotNetCoreCLI@2
87+
displayName: 'Run Unit Tests (.NET 10.0)'
88+
inputs:
89+
command: 'test'
90+
arguments: '--no-restore --no-build --framework net10.0 /noautorsp'
91+
testRunTitle: 'Windows .NET 10.0'
92+
condition: succeededOrFailed()
9493

9594
- powershell: |
9695
$bin = "$(Build.SourcesDirectory)\$(ArtifactsDirectoryName)\bin"
@@ -150,14 +149,13 @@ jobs:
150149
testRunTitle: 'Linux .NET 9.0'
151150
condition: succeededOrFailed()
152151

153-
# Disabled due to MSBuild.ProjectCreation dependency issue
154-
# - task: DotNetCoreCLI@2
155-
# displayName: 'Run Unit Tests (.NET 10.0)'
156-
# inputs:
157-
# command: 'test'
158-
# arguments: '--no-restore --no-build --framework net10.0 /noautorsp'
159-
# testRunTitle: 'Linux .NET 10.0'
160-
# condition: succeededOrFailed()
152+
- task: DotNetCoreCLI@2
153+
displayName: 'Run Unit Tests (.NET 10.0)'
154+
inputs:
155+
command: 'test'
156+
arguments: '--no-restore --no-build --framework net10.0 /noautorsp'
157+
testRunTitle: 'Linux .NET 10.0'
158+
condition: succeededOrFailed()
161159

162160
- bash: |
163161
BIN_DIR="$(Build.SourcesDirectory)/$(ArtifactsDirectoryName)/bin"
@@ -217,14 +215,13 @@ jobs:
217215
testRunTitle: 'MacOS .NET 9.0'
218216
condition: succeededOrFailed()
219217

220-
# Disabled due to MSBuild.ProjectCreation dependency issue
221-
# - task: DotNetCoreCLI@2
222-
# displayName: 'Run Unit Tests (.NET 10.0)'
223-
# inputs:
224-
# command: 'test'
225-
# arguments: '--no-restore --no-build --framework net10.0 /noautorsp'
226-
# testRunTitle: 'MacOS .NET 10.0'
227-
# condition: succeededOrFailed()
218+
- task: DotNetCoreCLI@2
219+
displayName: 'Run Unit Tests (.NET 10.0)'
220+
inputs:
221+
command: 'test'
222+
arguments: '--no-restore --no-build --framework net10.0 /noautorsp'
223+
testRunTitle: 'MacOS .NET 10.0'
224+
condition: succeededOrFailed()
228225

229226
- bash: |
230227
BIN_DIR="$(Build.SourcesDirectory)/$(ArtifactsDirectoryName)/bin"

src/Cargo.UnitTests/Microsoft.Build.Cargo.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<PrivateAssets>all</PrivateAssets>
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2323
</PackageReference>
24-
<PackageReference Include="Microsoft.Build.Utilities.Core" />
24+
<PackageReference Include="Microsoft.Build.Utilities.Core" ExcludeAssets="runtime" />
2525
<PackageReference Include="Microsoft.Build" ExcludeAssets="runtime" />
2626
<PackageReference Include="Microsoft.Build.Framework" ExcludeAssets="runtime" />
2727
</ItemGroup>

src/CopyOnWrite.UnitTests/CopyUpToDateTests.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,15 @@
66
using Microsoft.Build.Tasks;
77
using Microsoft.Build.UnitTests.Common;
88
using Microsoft.Build.Utilities;
9+
using Microsoft.Build.Utilities.ProjectCreation;
10+
using Shouldly;
911
using System;
1012
using System.IO;
1113
using Xunit;
1214
using Xunit.Abstractions;
1315

1416
namespace Microsoft.Build.CopyOnWrite.UnitTests;
1517

16-
// These tests rely on Microsoft.Build.Framework which has only a net472 and current-framework target.
17-
// Don't compile these tests for .NET versions in between as Microsoft.Build.Framework.dll will not be
18-
// propagated to the output dir.
19-
#if !NET8_0_OR_GREATER
20-
2118
public class CopyUpToDateTests : MSBuildSdkTestBase
2219
{
2320
// If the developer has specified this environment variable (also used in the base CoW library unit tests),
@@ -61,13 +58,13 @@ public void CopyFileMultipleTimes(bool skipUnchangedFiles, bool runUnderReFsIfAv
6158
var originalFileInfo = new FileInfo(file1Path);
6259
string destDir = Path.Combine(tempDir.Path, "dest");
6360

64-
var engine = new MockEngine(logToConsole: true);
61+
BuildEngine engine = BuildEngine.Create();
6562

6663
Copy copy = CreateFreshCopyTask();
6764

6865
copy.Execute();
69-
engine.MockLogger.AssertNoErrors();
70-
engine.MockLogger.AssertNoWarnings();
66+
engine.ErrorEvents.ShouldBeEmpty();
67+
engine.WarningEvents.ShouldBeEmpty();
7168
var file1Info = new FileInfo(file1Path);
7269
AssertExistenceAndEqualTimes();
7370

@@ -82,8 +79,8 @@ public void CopyFileMultipleTimes(bool skipUnchangedFiles, bool runUnderReFsIfAv
8279
{
8380
copy = CreateFreshCopyTask();
8481
copy.Execute();
85-
engine.MockLogger.AssertNoErrors();
86-
engine.MockLogger.AssertNoWarnings();
82+
engine.ErrorEvents.ShouldBeEmpty();
83+
engine.WarningEvents.ShouldBeEmpty();
8784

8885
file1Info = new FileInfo(file1Path);
8986
AssertExistenceAndEqualTimes();
@@ -127,5 +124,3 @@ Copy CreateFreshCopyTask()
127124
}
128125
}
129126
}
130-
131-
#endif

src/CopyOnWrite.UnitTests/Microsoft.Build.CopyOnWrite.UnitTests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
</PropertyGroup>
66
<ItemGroup>
77
<PackageReference Include="CopyOnWrite" />
8-
<PackageReference Include="Microsoft.Build" />
98
<PackageReference Include="Microsoft.NET.Test.Sdk" />
109
<PackageReference Include="Microsoft.Win32.Registry" />
1110
<PackageReference Include="MSBuild.ProjectCreation" />

0 commit comments

Comments
 (0)