Skip to content

Commit 3b653cc

Browse files
authored
Fix .NET Framework test helix submission (#44481)
1 parent 1b67c37 commit 3b653cc

File tree

3 files changed

+41
-40
lines changed

3 files changed

+41
-40
lines changed

test/Microsoft.DotNet.ApiCompat.IntegrationTests/CompatibleFrameworkInPackageValidatorIntegrationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public CompatibleFrameworkInPackageValidatorIntegrationTests(ITestOutputHelper l
3030
return (log, validator);
3131
}
3232

33-
[Fact]
33+
[RequiresMSBuildVersionFact("17.12", Reason = "Needs System.Text.Json 8.0.5")]
3434
public void CompatibleFrameworksInPackage()
3535
{
3636
string name = Path.GetFileNameWithoutExtension(Path.GetTempFileName());
@@ -67,7 +67,7 @@ public void test(string test) { }
6767
Assert.Contains($"CP0002 Member 'void PackageValidationTests.First.test(string)' exists on lib/netstandard2.0/{assemblyName} but not on lib/{ToolsetInfo.CurrentTargetFramework}/{assemblyName}", log.errors);
6868
}
6969

70-
[Fact]
70+
[RequiresMSBuildVersionFact("17.12", Reason = "Needs System.Text.Json 8.0.5")]
7171
public void MultipleCompatibleFrameworksInPackage()
7272
{
7373
string name = Path.GetFileNameWithoutExtension(Path.GetTempFileName());

test/Microsoft.DotNet.ApiCompat.IntegrationTests/Task/ValidatePackageTargetIntegrationTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public void ValidatePackageTargetWithIncorrectBaselinePackagePath()
141141
Assert.Equal(0, result.ExitCode);
142142
}
143143

144-
[RequiresMSBuildVersionFact("17.0.0.32901")]
144+
[RequiresMSBuildVersionFact("17.12", Reason = "Needs System.Text.Json 8.0.5")]
145145
public void ValidatePackageWithReferences()
146146
{
147147
string testDependencySource = @"namespace PackageValidationTests { public class ItermediateBaseClass
@@ -184,7 +184,7 @@ public void ValidatePackageWithReferences()
184184
Assert.Contains($"CP0008 Type 'PackageValidationTests.First' does not implement interface 'PackageValidationTests.IBaseInterface' on lib/{ToolsetInfo.CurrentTargetFramework}/{asset.TestProject.Name}.dll but it does on lib/netstandard2.0/{asset.TestProject.Name}.dll", log.errors);
185185
}
186186

187-
[RequiresMSBuildVersionTheory("17.0.0.32901")]
187+
[RequiresMSBuildVersionTheory("17.12")]
188188
[InlineData(false, true, false)]
189189
[InlineData(false, false, false)]
190190
[InlineData(true, false, false)]
@@ -224,7 +224,7 @@ public void ValidateOnlyErrorWhenAReferenceIsRequired(bool createDependencyToDum
224224
Assert.DoesNotContain($"CP1002 Could not find matching assembly: '{testDummyDependency.Name}.dll' in any of the search directories.", log.errors);
225225
}
226226

227-
[RequiresMSBuildVersionTheory("17.0.0.32901")]
227+
[RequiresMSBuildVersionTheory("17.12")]
228228
[InlineData(false, true, false, false)]
229229
[InlineData(true, false, false, false)]
230230
[InlineData(true, true, true, true)]
@@ -270,7 +270,7 @@ namespace PackageValidationTests { public class MyForwardedType : ISomeInterface
270270
Assert.Contains($"CP1002 Could not find matching assembly: '{dependency.Name}.dll' in any of the search directories.", log.errors);
271271
}
272272

273-
[RequiresMSBuildVersionFact("17.0.0.32901")]
273+
[RequiresMSBuildVersionFact("17.12", Reason = "Needs System.Text.Json 8.0.5")]
274274
public void EnsureOnlyOneAssemblyLoadErrorIsLoggedPerMissingAssembly()
275275
{
276276
string dependencySourceCode = @"namespace PackageValidationTests { public interface ISomeInterface { }
@@ -310,7 +310,7 @@ namespace PackageValidationTests { public class MyForwardedType : ISomeInterface
310310
Assert.Single(log.errors, e => e.Contains("CP1002"));
311311
}
312312

313-
[RequiresMSBuildVersionTheory("17.0.0.32901")]
313+
[RequiresMSBuildVersionTheory("17.12")]
314314
[InlineData(true)]
315315
[InlineData(false)]
316316
public void ValidateMissingReferencesIsOnlyLoggedWhenRunningWithReferences(bool useReferences)

test/UnitTests.proj

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.DotNet.Helix.Sdk">
1+
<Project Sdk="Microsoft.DotNet.Helix.Sdk">
22

33
<PropertyGroup>
44
<HelixType>test/product/</HelixType>
@@ -12,44 +12,45 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true'" Include="**\*.Tests.csproj" Exclude="**\*.AoT.Tests.csproj;TestAssets\**\*.Tests.csproj" />
15+
<SDKCustomXUnitProject Include="**\*.Tests.csproj" Exclude="**\*.AoT.Tests.csproj;TestAssets\**\*.Tests.csproj" />
16+
1617
<!--containers tests end with UnitTests and IntegrationTests, therefore included manually -->
17-
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true'" Include="containerize.UnitTests\containerize.UnitTests.csproj" />
18-
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true' And $(_AGENTOSNAME) != 'Windows_NT_FullFramework'" Include="Microsoft.NET.Build.Containers.IntegrationTests\Microsoft.NET.Build.Containers.IntegrationTests.csproj" />
19-
<!-- on Windows_NT_FullFramework leg, net472 tests should be run -->
20-
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true' And $(_AGENTOSNAME) == 'Windows_NT_FullFramework'" Include="Microsoft.NET.Build.Containers.IntegrationTests\Microsoft.NET.Build.Containers.IntegrationTests.csproj">
21-
<TargetFramework>net472</TargetFramework>
22-
<RuntimeTargetFramework>net472</RuntimeTargetFramework>
23-
</SDKCustomXUnitProject>
24-
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true'" Include="Microsoft.NET.Build.Containers.UnitTests\Microsoft.NET.Build.Containers.UnitTests.csproj" />
25-
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true'" Include="..\src\Tasks\Microsoft.NET.Build.Extensions.Tasks.UnitTests\Microsoft.NET.Build.Extensions.Tasks.UnitTests.csproj">
26-
<ExcludeAdditionalParameters>true</ExcludeAdditionalParameters>
27-
</SDKCustomXUnitProject>
28-
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true'" Include="..\src\Tasks\Microsoft.NET.Build.Tasks.UnitTests\Microsoft.NET.Build.Tasks.UnitTests.csproj">
29-
<ExcludeAdditionalParameters>true</ExcludeAdditionalParameters>
30-
</SDKCustomXUnitProject>
31-
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' == 'true'" Include="**\*.AoT.Tests.csproj" />
32-
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true' And $(_AGENTOSNAME) == 'Windows_NT_FullFramework'" Include="Microsoft.DotNet.MSBuildSdkResolver.Tests\Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj">
33-
<TargetFramework>net472</TargetFramework>
34-
<RuntimeTargetFramework>net472</RuntimeTargetFramework>
35-
</SDKCustomXUnitProject>
36-
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true' And $(_AGENTOSNAME) == 'Windows_NT_FullFramework'" Include="Microsoft.DotNet.ApiCompat.IntegrationTests\Microsoft.DotNet.ApiCompat.IntegrationTests.csproj">
37-
<TargetFramework>net472</TargetFramework>
38-
<RuntimeTargetFramework>net472</RuntimeTargetFramework>
39-
</SDKCustomXUnitProject>
40-
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true' And $(_AGENTOSNAME) == 'Windows_NT_FullFramework'" Include="Microsoft.DotNet.PackageValidation.Tests\Microsoft.DotNet.PackageValidation.Tests.csproj">
41-
<TargetFramework>net472</TargetFramework>
42-
<RuntimeTargetFramework>net472</RuntimeTargetFramework>
43-
</SDKCustomXUnitProject>
44-
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true' And $(_AGENTOSNAME) == 'Windows_NT_FullFramework'" Include="Microsoft.NET.Sdk.Publish.Tasks.Tests\Microsoft.NET.Sdk.Publish.Tasks.Tests.csproj">
45-
<TargetFramework>net472</TargetFramework>
46-
<RuntimeTargetFramework>net472</RuntimeTargetFramework>
47-
</SDKCustomXUnitProject>
18+
<SDKCustomXUnitProject Include="containerize.UnitTests\containerize.UnitTests.csproj" />
19+
<SDKCustomXUnitProject Include="Microsoft.NET.Build.Containers.IntegrationTests\Microsoft.NET.Build.Containers.IntegrationTests.csproj" />
20+
21+
<SDKCustomXUnitProject Include="Microsoft.NET.Build.Containers.UnitTests\Microsoft.NET.Build.Containers.UnitTests.csproj" />
22+
<SDKCustomXUnitProject Include="..\src\Tasks\Microsoft.NET.Build.Extensions.Tasks.UnitTests\Microsoft.NET.Build.Extensions.Tasks.UnitTests.csproj" ExcludeAdditionalParameters="true" />
23+
<SDKCustomXUnitProject Include="..\src\Tasks\Microsoft.NET.Build.Tasks.UnitTests\Microsoft.NET.Build.Tasks.UnitTests.csproj" ExcludeAdditionalParameters="true" />
4824

4925
<!-- Don't run MSI installation tests in Helix / CI -->
5026
<SdkCustomXUnitProject Remove="dotnet-MsiInstallation.Tests\**\*" />
5127
</ItemGroup>
5228

29+
<!-- When TestFullMSBuild=true, include the .NET Framework tests. .NETCoreApp tests are also executed
30+
as that validates running tests with desktop msbuild. -->
31+
<ItemGroup Condition="'$(TestFullMSBuild)' == 'true'">
32+
<SDKCustomXUnitProject Include="
33+
core-sdk-tasks.Tests\core-sdk-tasks.Tests.csproj;
34+
Microsoft.DotNet.ApiCompat.IntegrationTests\Microsoft.DotNet.ApiCompat.IntegrationTests.csproj;
35+
Microsoft.DotNet.ApiCompat.Tests\Microsoft.DotNet.ApiCompat.Tests.csproj;
36+
Microsoft.DotNet.ApiCompatibility.Tests\Microsoft.DotNet.ApiCompatibility.Tests.csproj;
37+
Microsoft.DotNet.ApiSymbolExtensions.Tests\Microsoft.DotNet.ApiSymbolExtensions.Tests.csproj;
38+
Microsoft.DotNet.MSBuildSdkResolver.Tests\Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj;
39+
Microsoft.DotNet.PackageValidation.Tests\Microsoft.DotNet.PackageValidation.Tests.csproj;
40+
Microsoft.DotNet.TemplateLocator.Tests\Microsoft.DotNet.TemplateLocator.Tests.csproj;
41+
Microsoft.NET.Build.Containers.IntegrationTests\Microsoft.NET.Build.Containers.IntegrationTests.csproj;
42+
Microsoft.NET.Sdk.Publish.Tasks.Tests\Microsoft.NET.Sdk.Publish.Tasks.Tests.csproj;
43+
Microsoft.NET.Sdk.WorkloadManifestReader.Tests\Microsoft.NET.Sdk.WorkloadManifestReader.Tests.csproj;
44+
Microsoft.Win32.Msi.Tests\Microsoft.Win32.Msi.Tests.csproj"
45+
TargetFramework="net472"
46+
RuntimeTargetFramework="net472" />
47+
</ItemGroup>
48+
49+
<ItemGroup Condition="'$(RunAoTTests)' == 'true'">
50+
<SDKCustomXUnitProject Remove="@(SDKCustomXUnitProject)" />
51+
<SDKCustomXUnitProject Include="**\*.AoT.Tests.csproj" />
52+
</ItemGroup>
53+
5354
<ItemGroup Condition=" '$(CustomHelixTargetQueue)' != '' ">
5455
<HelixTargetQueue Include="$(CustomHelixTargetQueue)" />
5556
</ItemGroup>

0 commit comments

Comments
 (0)