diff --git a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj
index ec4b53947305..8edcec2839cc 100644
--- a/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj
+++ b/src/Assets/TestProjects/BlazorHostedRID/blazorhosted/blazorhosted-rid.csproj
@@ -3,6 +3,8 @@
$(AspNetTestTfm)
linux-x64
+
+ true
diff --git a/src/Layout/toolset-tasks/toolset-tasks.csproj b/src/Layout/toolset-tasks/toolset-tasks.csproj
index b7ab9f2b9c52..b8cf6f95c1c1 100644
--- a/src/Layout/toolset-tasks/toolset-tasks.csproj
+++ b/src/Layout/toolset-tasks/toolset-tasks.csproj
@@ -3,6 +3,7 @@
$(SdkTargetFramework);net472
$(SdkTargetFramework)
true
+ true
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.GenerateImplicitNamespaceImports.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.GenerateImplicitNamespaceImports.targets
new file mode 100644
index 000000000000..661e992bb1fb
--- /dev/null
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.GenerateImplicitNamespaceImports.targets
@@ -0,0 +1,57 @@
+
+
+
+
+ $(IntermediateOutputPath)$(MSBuildProjectName).ImplicitNamespaceImports$(DefaultLanguageSourceExtension)
+ false
+
+
+
+
+
+
+
+ <_UniqueImport Include="@(Import->Distinct())" />
+ <_ImportFileLine Include="// %3Cautogenerated />"/>
+ <_ImportFileLine Include="global using global::%(_UniqueImport.Identity)%3B"/>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.props b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.props
index 2495fed1f71c..55a034ce504a 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.props
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.props
@@ -82,4 +82,16 @@ Copyright (c) .NET Foundation. All rights reserved.
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.VisualBasic.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.VisualBasic.targets
index d728a513df8f..a42282cfd212 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.VisualBasic.targets
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.VisualBasic.targets
@@ -10,9 +10,6 @@ Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
-
- $(DisableImplicitFrameworkReferences)
-
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
index bd631484dc53..14e555776919 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
@@ -39,6 +39,7 @@ Copyright (c) .NET Foundation. All rights reserved.
true
<_GenerateRuntimeConfigurationPropertyInputsCache Condition="'$(_GenerateRuntimeConfigurationPropertyInputsCache)' == ''">$(IntermediateOutputPath)$(MSBuildProjectName).genruntimeconfig.cache
<_GenerateRuntimeConfigurationPropertyInputsCache>$([MSBuild]::NormalizePath($(MSBuildProjectDirectory), $(_GenerateRuntimeConfigurationPropertyInputsCache)))
+ $(DisableImplicitFrameworkReferences)
@@ -1087,6 +1088,7 @@ Copyright (c) .NET Foundation. All rights reserved.
+
diff --git a/src/Tests/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs b/src/Tests/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs
index e7712d91610d..8c3c5770ce0b 100644
--- a/src/Tests/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs
+++ b/src/Tests/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs
@@ -21,7 +21,7 @@ public GivenDotNetUsesMSBuild(ITestOutputHelper log) : base(log)
{
}
- [RequiresMSBuildVersionFact("16.8.0")]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void ItCanNewRestoreBuildRunCleanMSBuildProject()
{
string projectDirectory = _testAssetsManager.CreateTestDirectory().Path;
diff --git a/src/Tests/Microsoft.DotNet.ApiCompatibility.Tests/Rules/AssemblyIdentityMustMatchTests.cs b/src/Tests/Microsoft.DotNet.ApiCompatibility.Tests/Rules/AssemblyIdentityMustMatchTests.cs
index c788e7cc44c6..cba073035efd 100644
--- a/src/Tests/Microsoft.DotNet.ApiCompatibility.Tests/Rules/AssemblyIdentityMustMatchTests.cs
+++ b/src/Tests/Microsoft.DotNet.ApiCompatibility.Tests/Rules/AssemblyIdentityMustMatchTests.cs
@@ -34,7 +34,7 @@ public static void AssemblyNamesDoNotMatch()
Assert.Equal(expected, differences.First(), CompatDifferenceComparer.Default);
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void AssemblyCultureMustBeCompatible()
{
// setting different assembly culture for net6.0
@@ -54,7 +54,7 @@ public void AssemblyCultureMustBeCompatible()
TestAsset testAsset = _testAssetsManager.CreateTestProject(testProject);
BuildCommand buildCommand = new(testAsset);
buildCommand.Execute().Should().Pass();
-
+
string leftDllPath = Path.Combine(buildCommand.GetOutputDirectory("netstandard2.0").FullName, "Project.dll");
string rightDllPath = Path.Combine(buildCommand.GetOutputDirectory("net6.0").FullName, "Project.dll");
IAssemblySymbol leftSymbols = new AssemblySymbolLoader().LoadAssembly(leftDllPath);
@@ -68,7 +68,7 @@ public void AssemblyCultureMustBeCompatible()
Assert.Equal(expected, differences.First(), CompatDifferenceComparer.Default);
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void AssemblyVersionMustBeCompatible()
{
// setting different assembly culture for netstanard2.0
@@ -102,7 +102,7 @@ public void AssemblyVersionMustBeCompatible()
Assert.Equal(expected, differences.First(), CompatDifferenceComparer.Default);
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void AssemblyVersionMustBeStrictlyCompatible()
{
// setting different assembly culture for netstanard2.0
@@ -144,7 +144,7 @@ public void AssemblyVersionMustBeStrictlyCompatible()
Assert.Equal(expected, differences.First(), CompatDifferenceComparer.Default);
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void AssemblyKeyTokenMustBeCompatible()
{
var testAsset = _testAssetsManager
@@ -165,7 +165,7 @@ public void AssemblyKeyTokenMustBeCompatible()
Assert.Empty(differences);
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void LeftAssemblyKeyTokenNull()
{
var testAsset = _testAssetsManager
@@ -185,7 +185,7 @@ public void LeftAssemblyKeyTokenNull()
Assert.Empty(differences);
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void RightAssemblyKeyTokenNull()
{
var testAsset = _testAssetsManager
@@ -208,7 +208,7 @@ public void RightAssemblyKeyTokenNull()
Assert.Equal(expected, differences.First(), CompatDifferenceComparer.Default);
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void RetargetableFlagSet()
{
var testAsset = _testAssetsManager
@@ -230,7 +230,7 @@ public void RetargetableFlagSet()
Assert.Empty(differences);
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void LeftAssemblyKeyTokenNullStrictMode()
{
var testAsset = _testAssetsManager
diff --git a/src/Tests/Microsoft.DotNet.PackageValidation.Tests/ValidatePackageTargetTests.cs b/src/Tests/Microsoft.DotNet.PackageValidation.Tests/ValidatePackageTargetTests.cs
index 44df2e531489..8a97dd28114b 100644
--- a/src/Tests/Microsoft.DotNet.PackageValidation.Tests/ValidatePackageTargetTests.cs
+++ b/src/Tests/Microsoft.DotNet.PackageValidation.Tests/ValidatePackageTargetTests.cs
@@ -15,7 +15,7 @@ public ValidatePackageTargetTests(ITestOutputHelper log) : base(log)
{
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void InvalidPackage()
{
var testAsset = _testAssetsManager
@@ -30,7 +30,7 @@ public void InvalidPackage()
Assert.Contains("error CP0002: Member 'PackageValidationTestProject.Program.SomeAPINotIn6_0()' exists on lib/netstandard2.0/PackageValidationTestProject.dll but not on lib/net6.0/PackageValidationTestProject.dll", result.StdOut);
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void ValidatePackageTargetRunsSuccessfully()
{
var testAsset = _testAssetsManager
@@ -44,7 +44,7 @@ public void ValidatePackageTargetRunsSuccessfully()
Assert.Equal(0, result.ExitCode);
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void ValidatePackageTargetRunsSuccessfullyWithBaselineCheck()
{
var testAsset = _testAssetsManager
@@ -64,7 +64,7 @@ public void ValidatePackageTargetRunsSuccessfullyWithBaselineCheck()
Assert.Equal(0, result.ExitCode);
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void ValidatePackageTargetRunsSuccessfullyWithBaselineVersion()
{
var testAsset = _testAssetsManager
@@ -83,7 +83,7 @@ public void ValidatePackageTargetRunsSuccessfullyWithBaselineVersion()
Assert.Equal(0, result.ExitCode);
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void ValidatePackageTargetFailsWithBaselineVersion()
{
var testAsset = _testAssetsManager
@@ -104,7 +104,7 @@ public void ValidatePackageTargetFailsWithBaselineVersion()
Assert.Contains("error CP0002: Member 'PackageValidationTestProject.Program.SomeApiNotInLatestVersion()' exists on [Baseline] lib/netstandard2.0/PackageValidationTestProject.dll but not on lib/netstandard2.0/PackageValidationTestProject.dll", result.StdOut);
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void ValidatePackageTargetWithIncorrectBaselinePackagePath()
{
var testAsset = _testAssetsManager
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs
index d8f2174e127b..5751f898c8c7 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs
@@ -34,7 +34,7 @@ public static void Main(string [] args)
}
}";
- [WindowsOnlyTheory]
+ [WindowsOnlyRequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("net6.0", true)]
[InlineData("netcoreapp3.1", false)]
public void Multiple_frameworks_are_written_to_runtimeconfig_when_there_are_multiple_FrameworkReferences(string targetFramework, bool shouldIncludeBaseFramework)
@@ -149,7 +149,7 @@ public void ForceGenerateRuntimeConfigurationFiles_works_even_on_netFramework_tf
Assert.True(File.Exists(runtimeConfigFile), $"Expected to generate runtime config file '{runtimeConfigFile}'");
}
- [WindowsOnlyFact]
+ [WindowsOnlyRequiresMSBuildVersionFact("17.0.0.32901")]
public void DuplicateFrameworksAreNotWrittenToRuntimeConfigWhenThereAreDifferentProfiles()
{
var testProject = new TestProject()
@@ -494,7 +494,7 @@ public void BuildFailsIfRuntimePackHasNotBeenRestored()
TargetFrameworks = "netcoreapp3.0",
IsExe = true,
};
-
+
// Use a test-specific packages folder
testProject.AdditionalProperties["RestorePackagesPath"] = @"$(MSBuildProjectDirectory)\packages";
@@ -676,7 +676,7 @@ public void TargetingPackVersionCanBeSpecifiedOnFrameworkReference()
// Transitive framework references require NuGet support, which isn't currently
// in the full Framework MSBuild we use in CI, so only run these tests for
// core MSBuild for now
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void TransitiveFrameworkReferenceFromProjectReference()
{
var testProject = new TestProject()
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
index 2ee6be76e08c..aa8df78a4a55 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
@@ -841,7 +841,7 @@ public void It_marks_package_references_as_externally_resolved(bool? markAsExter
}
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("net5.0", false, false, false, null)] // Pre .NET 6.0 predefinedCulturesOnly is not supported.
[InlineData("net5.0", true, false, false, null)] // Pre .NET 6.0 predefinedCulturesOnly is not supported.
[InlineData("net5.0", false, true, true, "True")] // Pre .NET 6.0 predefinedCulturesOnly can end up in the runtime config file but with no effect at runtime.
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSSupportedVersion.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSSupportedVersion.cs
index a1fef63b3ae6..41a303b2ee88 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSSupportedVersion.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSSupportedVersion.cs
@@ -167,7 +167,7 @@ public void WhenTargetPlatformMinVersionIsSetForWindowsItIsUsedForTheSupportedOS
.And.HaveStdOutContaining(SupportedOSPlatformAttribute("Windows10.0.18362.0"));
}
- [WindowsOnlyFact]
+ [WindowsOnlyRequiresMSBuildVersionFact("17.0.0.32901")]
public void WhenTargetingWindowsSupportedOSVersionPropertySetsTargetPlatformMinVersion()
{
TestProject testProject = SetUpProject("net6.0-windows10.0.19041");
@@ -190,7 +190,7 @@ public void WhenTargetingWindowsSupportedOSVersionPropertySetsTargetPlatformMinV
getValuesCommand.GetValues()
.Should()
- .BeEquivalentTo("10.0.18362.0");
+ .BeEquivalentTo("10.0.18362.0");
}
[WindowsOnlyFact]
@@ -266,7 +266,7 @@ private static string TargetPlatformAttribute(string targetPlatform)
return expected;
}
-
+
private static string SupportedOSPlatformAttribute(string supportedOSPlatform)
{
string expected = string.IsNullOrEmpty(supportedOSPlatform) ?
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs
index ecc371b1ca0c..985047069bb7 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs
@@ -405,7 +405,7 @@ public void It_stops_generating_runtimeconfig_dev_json_after_net6(string targetF
File.Exists(runtimeconfigFile).Should().Be(shouldGenerateRuntimeConfigDevJson);
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("netcoreapp2.0")]
[InlineData("netcoreapp3.0")]
[InlineData("net5.0")]
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs
index 6ccebf8b3773..46388b7347cf 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs
@@ -149,7 +149,7 @@ public void It_imports_when_targeting_dotnet_3()
getValuesCommand.GetValues().ShouldBeEquivalentTo(new[] { "true" });
}
- [WindowsOnlyFact]
+ [WindowsOnlyRequiresMSBuildVersionFact("17.0.0.32901", Skip = "https://github.com/dotnet/sdk/issues/18800")]
public void It_builds_successfully_when_targeting_net_framework()
{
var testDirectory = _testAssetsManager.CreateTestDirectory().Path;
@@ -241,7 +241,7 @@ public void It_fails_if_target_platform_identifier_and_version_are_invalid()
.NotHaveStdOutContaining("NETSDK1140");
}
- [WindowsOnlyFact]
+ [WindowsOnlyRequiresMSBuildVersionFact("17.0.0.32901")]
public void UseWPFCanBeSetInDirectoryBuildTargets()
{
var testDir = _testAssetsManager.CreateTestDirectory();
@@ -367,7 +367,7 @@ public void WindowsWorkloadIsInstalledForNet5AndUp(string targetFramework, bool
getValueCommand.GetValues()
.Should()
.Contain("windows");
- }
+ }
else
{
getValueCommand.GetValues()
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToControlGeneratedAssemblyInfo.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToControlGeneratedAssemblyInfo.cs
index b357a31a836b..5f6eb3fd9f8d 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToControlGeneratedAssemblyInfo.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToControlGeneratedAssemblyInfo.cs
@@ -370,7 +370,7 @@ public void It_includes_internals_visible_to()
AssemblyInfo.Get(assemblyPath)["InternalsVisibleToAttribute"].Should().Be("Tests");
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData(true, true)]
[InlineData(true, false)]
[InlineData(false, false)]
@@ -429,7 +429,7 @@ public void TestPreviewFeatures(bool enablePreviewFeatures, bool generateRequire
}
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void It_doesnt_includes_requires_preview_features()
{
var testAsset = _testAssetsManager
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToGenerateImplicitNamespaceImports_DotNet.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToGenerateImplicitNamespaceImports_DotNet.cs
new file mode 100644
index 000000000000..f78bfe0a7e40
--- /dev/null
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToGenerateImplicitNamespaceImports_DotNet.cs
@@ -0,0 +1,215 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System.Collections.Generic;
+using System.IO;
+using FluentAssertions;
+using Microsoft.NET.TestFramework;
+using Microsoft.NET.TestFramework.Assertions;
+using Microsoft.NET.TestFramework.Commands;
+using Microsoft.NET.TestFramework.ProjectConstruction;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace Microsoft.NET.Build.Tests
+{
+ public class GivenThatWeWantToGenerateImplicitNamespaceImports_DotNet : SdkTest
+ {
+ public GivenThatWeWantToGenerateImplicitNamespaceImports_DotNet(ITestOutputHelper log) : base(log) { }
+
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
+ public void It_generates_dotnet_imports_and_builds_successfully()
+ {
+ var tfm = "net6.0";
+ var testProject = CreateTestProject(tfm);
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+ var importFileName = $"{testAsset.TestProject.Name}.ImplicitNamespaceImports.cs";
+
+ var buildCommand = new BuildCommand(testAsset);
+ buildCommand
+ .Execute()
+ .Should()
+ .Pass();
+
+ var outputDirectory = buildCommand.GetIntermediateDirectory(tfm);
+
+ outputDirectory.Should().HaveFile(importFileName);
+
+ File.ReadAllText(Path.Combine(outputDirectory.FullName, importFileName)).Should().Be(
+@"//
+global using global::System;
+global using global::System.Collections.Generic;
+global using global::System.IO;
+global using global::System.Linq;
+global using global::System.Net.Http;
+global using global::System.Threading;
+global using global::System.Threading.Tasks;
+");
+ }
+
+ [Fact]
+ public void It_can_disable_dotnet_imports()
+ {
+ var tfm = "net6.0";
+ var testProject = CreateTestProject(tfm);
+ testProject.AdditionalProperties["DisableImplicitNamespaceImports_DotNet"] = "true";
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+ var importFileName = $"{testAsset.TestProject.Name}.ImplicitNamespaceImports.cs";
+
+ var buildCommand = new BuildCommand(testAsset);
+ buildCommand
+ .Execute()
+ .Should()
+ .Fail();
+
+ var outputDirectory = buildCommand.GetIntermediateDirectory(tfm);
+
+ outputDirectory.Should().NotHaveFile(importFileName);
+ }
+
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
+ public void It_can_remove_specific_imports_in_project_file()
+ {
+ var tfm = "net6.0";
+ var testProject = CreateTestProject(tfm);
+ testProject.AdditionalItems["Import"] = new Dictionary { ["Remove"] = "System.IO" };
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+ var importFileName = $"{testAsset.TestProject.Name}.ImplicitNamespaceImports.cs";
+
+
+ var buildCommand = new BuildCommand(testAsset);
+ buildCommand
+ .Execute()
+ .Should()
+ .Pass();
+
+ var outputDirectory = buildCommand.GetIntermediateDirectory(tfm);
+
+ outputDirectory.Should().HaveFile(importFileName);
+
+ File.ReadAllText(Path.Combine(outputDirectory.FullName, importFileName)).Should().Be(
+@"//
+global using global::System;
+global using global::System.Collections.Generic;
+global using global::System.Linq;
+global using global::System.Net.Http;
+global using global::System.Threading;
+global using global::System.Threading.Tasks;
+");
+ }
+
+ [Fact]
+ public void It_can_generate_custom_imports()
+ {
+ var tfm = "net6.0";
+ var testProject = CreateTestProject(tfm);
+ testProject.AdditionalProperties["DisableImplicitNamespaceImports_DotNet"] = "true";
+ testProject.AdditionalItems["Import"] = new Dictionary { ["Include"] = "CustomNamespace" };
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+ var importFileName = $"{testAsset.TestProject.Name}.ImplicitNamespaceImports.cs";
+
+ var buildCommand = new BuildCommand(testAsset);
+ buildCommand
+ .Execute()
+ .Should()
+ .Fail();
+
+ var outputDirectory = buildCommand.GetIntermediateDirectory(tfm);
+
+ outputDirectory.Should().HaveFile(importFileName);
+
+ File.ReadAllText(Path.Combine(outputDirectory.FullName, importFileName)).Should().Be(
+@"//
+global using global::CustomNamespace;
+");
+ }
+
+ [Fact]
+ public void It_ignores_duplicate_imports()
+ {
+ var tfm = "net6.0";
+ var testProject = CreateTestProject(tfm);
+ testProject.AdditionalProperties["DisableImplicitNamespaceImports_DotNet"] = "true";
+ testProject.AdditionalItems["Import"] = new Dictionary { ["Include"] = "CustomNamespace;CustomNamespace" };
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+ var importFileName = $"{testAsset.TestProject.Name}.ImplicitNamespaceImports.cs";
+
+ var buildCommand = new BuildCommand(testAsset);
+ buildCommand
+ .Execute()
+ .Should()
+ .Fail();
+
+ var outputDirectory = buildCommand.GetIntermediateDirectory(tfm);
+
+ outputDirectory.Should().HaveFile(importFileName);
+
+ File.ReadAllText(Path.Combine(outputDirectory.FullName, importFileName)).Should().Be(
+@"//
+global using global::CustomNamespace;
+");
+ }
+
+ [Fact]
+ public void It_can_disable_import_generation()
+ {
+ var tfm = "net6.0";
+ var testProject = CreateTestProject(tfm);
+ testProject.AdditionalProperties["DisableImplicitNamespaceImports"] = "true";
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+ var importFileName = $"{testAsset.TestProject.Name}.ImplicitNamespaceImports.cs";
+
+ var buildCommand = new BuildCommand(testAsset);
+ buildCommand
+ .Execute()
+ .Should()
+ .Fail();
+
+ var outputDirectory = buildCommand.GetIntermediateDirectory(tfm);
+
+ outputDirectory.Should().NotHaveFile(importFileName);
+ }
+
+ [Fact]
+ public void It_ignores_invalid_tfms()
+ {
+ var tfm = "net5.0";
+ var testProject = CreateTestProject(tfm);
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+ var importFileName = $"{testAsset.TestProject.Name}.ImplicitNamespaceImports.cs";
+
+ var buildCommand = new BuildCommand(testAsset);
+ buildCommand
+ .Execute()
+ .Should()
+ .Fail();
+
+ var outputDirectory = buildCommand.GetIntermediateDirectory(tfm);
+
+ outputDirectory.Should().NotHaveFile(importFileName);
+ }
+
+ private TestProject CreateTestProject(string tfm)
+ {
+ var testProject = new TestProject
+ {
+ IsExe = true,
+ TargetFrameworks = tfm,
+ ProjectSdk = "Microsoft.NET.Sdk"
+ };
+ testProject.SourceFiles["Program.cs"] = @"
+namespace ConsoleApp
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ Console.WriteLine(""Hello World!"");
+ }
+ }
+}
+";
+ return testProject;
+ }
+ }
+}
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToGenerateImplicitNamespaceImports_WebApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToGenerateImplicitNamespaceImports_WebApp.cs
new file mode 100644
index 000000000000..a33c9c488151
--- /dev/null
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToGenerateImplicitNamespaceImports_WebApp.cs
@@ -0,0 +1,115 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System.IO;
+using FluentAssertions;
+using Microsoft.NET.TestFramework;
+using Microsoft.NET.TestFramework.Assertions;
+using Microsoft.NET.TestFramework.Commands;
+using Microsoft.NET.TestFramework.ProjectConstruction;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace Microsoft.NET.Build.Tests
+{
+ public class GivenThatWeWantToGenerateImplicitNamespaceImports_WebApp : SdkTest
+ {
+
+ public GivenThatWeWantToGenerateImplicitNamespaceImports_WebApp(ITestOutputHelper log) : base(log) { }
+
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
+ public void It_generates_web_imports_and_builds_successfully()
+ {
+ var tfm = "net6.0";
+ var testProject = CreateTestProject(tfm);
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+ var importFileName = $"{testAsset.TestProject.Name}.ImplicitNamespaceImports.cs";
+
+ var buildCommand = new BuildCommand(testAsset);
+ buildCommand
+ .Execute()
+ .Should()
+ .Pass();
+
+ var outputDirectory = buildCommand.GetIntermediateDirectory(tfm);
+
+
+ outputDirectory.Should().HaveFile(importFileName);
+
+ File.ReadAllText(Path.Combine(outputDirectory.FullName, importFileName)).Should().Be(
+@"//
+global using global::System;
+global using global::System.Collections.Generic;
+global using global::System.IO;
+global using global::System.Linq;
+global using global::System.Net.Http;
+global using global::System.Threading;
+global using global::System.Threading.Tasks;
+global using global::System.Net.Http.Json;
+global using global::Microsoft.AspNetCore.Builder;
+global using global::Microsoft.AspNetCore.Hosting;
+global using global::Microsoft.AspNetCore.Http;
+global using global::Microsoft.AspNetCore.Routing;
+global using global::Microsoft.Extensions.Configuration;
+global using global::Microsoft.Extensions.DependencyInjection;
+global using global::Microsoft.Extensions.Hosting;
+global using global::Microsoft.Extensions.Logging;
+");
+ }
+
+ [Fact]
+ public void It_can_disable_web_imports()
+ {
+ var tfm = "net6.0";
+ var testProject = CreateTestProject(tfm);
+ testProject.AdditionalProperties["DisableImplicitNamespaceImports_Web"] = "true";
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+ var importFileName = $"{testAsset.TestProject.Name}.ImplicitNamespaceImports.cs";
+
+ var buildCommand = new BuildCommand(testAsset);
+ buildCommand
+ .Execute()
+ .Should()
+ .Fail();
+
+ var outputDirectory = buildCommand.GetIntermediateDirectory(tfm);
+
+ outputDirectory.Should().HaveFile(importFileName);
+
+ File.ReadAllText(Path.Combine(outputDirectory.FullName, importFileName)).Should().Be(
+@"//
+global using global::System;
+global using global::System.Collections.Generic;
+global using global::System.IO;
+global using global::System.Linq;
+global using global::System.Net.Http;
+global using global::System.Threading;
+global using global::System.Threading.Tasks;
+");
+ }
+
+ private TestProject CreateTestProject(string tfm)
+ {
+ var testProject = new TestProject
+ {
+ IsExe = true,
+ TargetFrameworks = tfm,
+ ProjectSdk = "Microsoft.NET.Sdk.Web"
+ };
+ testProject.SourceFiles["Program.cs"] = @"
+var builder = WebApplication.CreateBuilder(args);
+var app = builder.Build();
+
+if (app.Environment.IsDevelopment())
+{
+ app.UseDeveloperExceptionPage();
+}
+
+app.MapGet(""/"", (Func)(() => ""Hello World!""));
+
+app.Run();
+";
+ return testProject;
+ }
+ }
+}
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToGenerateImplicitNamespaceImports_Worker.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToGenerateImplicitNamespaceImports_Worker.cs
new file mode 100644
index 000000000000..32d8a0df297e
--- /dev/null
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToGenerateImplicitNamespaceImports_Worker.cs
@@ -0,0 +1,149 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System.Collections.Generic;
+using System.IO;
+using FluentAssertions;
+using Microsoft.NET.TestFramework;
+using Microsoft.NET.TestFramework.Assertions;
+using Microsoft.NET.TestFramework.Commands;
+using Microsoft.NET.TestFramework.ProjectConstruction;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace Microsoft.NET.Build.Tests
+{
+ public class GivenThatWeWantToGenerateImplicitNamespaceImports_Worker : SdkTest
+ {
+ public GivenThatWeWantToGenerateImplicitNamespaceImports_Worker(ITestOutputHelper log) : base(log) { }
+
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
+ public void It_generates_worker_imports_and_builds_successfully()
+ {
+ var tfm = "net6.0";
+ var testProject = CreateTestProject(tfm);
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+ var importFileName = $"{testAsset.TestProject.Name}.ImplicitNamespaceImports.cs";
+
+ var buildCommand = new BuildCommand(testAsset);
+ buildCommand
+ .Execute()
+ .Should()
+ .Pass();
+
+ var outputDirectory = buildCommand.GetIntermediateDirectory(tfm);
+
+ outputDirectory.Should().HaveFile(importFileName);
+
+ File.ReadAllText(Path.Combine(outputDirectory.FullName, importFileName)).Should().Be(
+@"//
+global using global::System;
+global using global::System.Collections.Generic;
+global using global::System.IO;
+global using global::System.Linq;
+global using global::System.Net.Http;
+global using global::System.Threading;
+global using global::System.Threading.Tasks;
+global using global::Microsoft.Extensions.Configuration;
+global using global::Microsoft.Extensions.DependencyInjection;
+global using global::Microsoft.Extensions.Hosting;
+global using global::Microsoft.Extensions.Logging;
+");
+ }
+
+ [Fact]
+ public void It_can_disable_worker_imports()
+ {
+ var tfm = "net6.0";
+ var testProject = CreateTestProject(tfm);
+ testProject.AdditionalProperties["DisableImplicitNamespaceImports_Worker"] = "true";
+ var testAsset = _testAssetsManager.CreateTestProject(testProject);
+ var importFileName = $"{testAsset.TestProject.Name}.ImplicitNamespaceImports.cs";
+
+ var buildCommand = new BuildCommand(testAsset);
+ buildCommand
+ .Execute()
+ .Should()
+ .Fail();
+
+ var outputDirectory = buildCommand.GetIntermediateDirectory(tfm);
+
+ outputDirectory.Should().HaveFile(importFileName);
+
+ File.ReadAllText(Path.Combine(outputDirectory.FullName, importFileName)).Should().Be(
+@"//
+global using global::System;
+global using global::System.Collections.Generic;
+global using global::System.IO;
+global using global::System.Linq;
+global using global::System.Net.Http;
+global using global::System.Threading;
+global using global::System.Threading.Tasks;
+");
+ }
+
+ private TestProject CreateTestProject(string tfm)
+ {
+ var testProject = new TestProject
+ {
+ IsExe = true,
+ TargetFrameworks = tfm,
+ ProjectSdk = "Microsoft.NET.Sdk.Worker"
+ };
+ testProject.AdditionalItems["PackageReference"] = new Dictionary {
+ ["Include"] = "Microsoft.Extensions.Hosting",
+ ["Version"] = "6.0.0-preview.5.21301.5"
+ };
+ testProject.SourceFiles["Program.cs"] = @"
+namespace WorkerApp
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ CreateHostBuilder(args).Build().Run();
+ }
+
+ public static IHostBuilder CreateHostBuilder(string[] args) =>
+ Host.CreateDefaultBuilder(args)
+ .ConfigureServices((hostContext, services) =>
+ {
+ services.AddHostedService();
+ });
+ }
+}
+";
+ testProject.SourceFiles["Worker.cs"] = @"
+namespace WorkerApp
+{
+ public class Worker : BackgroundService
+ {
+ private readonly ILogger _logger;
+
+ public Worker(ILogger logger)
+ {
+ _logger = logger;
+ }
+
+ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
+ {
+ while (!stoppingToken.IsCancellationRequested)
+ {
+ _logger.LogInformation(""Worker running at: {time}"", DateTimeOffset.Now);
+ try
+ {
+ await Task.Delay(1000, stoppingToken);
+ }
+ catch (OperationCanceledException)
+ {
+ return;
+ }
+ }
+ }
+ }
+}
+";
+ return testProject;
+ }
+ }
+}
diff --git a/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs b/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs
index 4a03c4709444..b9f8d8c95090 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs
@@ -136,7 +136,7 @@ private void RunTest(string buildFailureCode = null, [CallerMemberName] string c
.Fail()
.And
.HaveStdOutContaining(buildFailureCode);
- }
+ }
}
[Theory]
@@ -157,7 +157,7 @@ public void ReferencedExeWithLowerTargetFrameworkCanRun()
{
MainSelfContained = false;
ReferencedSelfContained = false;
-
+
CreateProjects();
ReferencedProject.TargetFrameworks = "netcoreapp3.1";
@@ -232,7 +232,7 @@ public void ReferencedExeCanRunWhenPublished(bool selfContained)
ReferencedSelfContained = selfContained;
TestWithPublish = true;
-
+
CreateProjects();
RunTest();
@@ -260,7 +260,7 @@ public void ReferencedExeCanRunWhenPublishedWithTrimming()
RunTest();
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("xunit")]
[InlineData("mstest")]
public void TestProjectCanReferenceExe(string testTemplateName)
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs
index 9e7ded5368a2..8a7dc735d420 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs
@@ -245,7 +245,7 @@ public void It_publishes_runtime_pack_resources_for_specific_languages()
});
}
- [Fact]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void NoStaticLibs()
{
var testAsset = _testAssetsManager
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs
index 4bfa637d0f70..1a99555ae517 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs
@@ -256,7 +256,7 @@ public void It_generates_a_single_file_for_self_contained_apps()
.NotHaveFiles(unexpectedFiles);
}
- [RequiresMSBuildVersionFact("16.8.0")]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void No_runtime_files_6_0()
{
var testProject = new TestProject()
@@ -280,7 +280,7 @@ public void No_runtime_files_6_0()
.OnlyHaveFiles(expectedFiles);
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData(true)]
[InlineData(false)]
public void It_supports_composite_r2r(bool extractAll)
@@ -569,7 +569,7 @@ public void It_rewrites_the_apphost_for_non_single_file_publish()
appHostSize.Should().BeLessThan(singleFileSize);
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("net6.0")]
public void ILLink_analyzer_warnings_are_produced(string targetFramework)
{
@@ -586,7 +586,7 @@ public void ILLink_analyzer_warnings_are_produced(string targetFramework)
.And.HaveStdOutContaining("(10,13): warning IL3001");
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("net6.0")]
public void ILLink_linker_analyzer_warnings_are_not_produced(string targetFramework)
{
@@ -605,7 +605,7 @@ public void ILLink_linker_analyzer_warnings_are_not_produced(string targetFramew
.And.NotHaveStdOutContaining("IL2026");
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("net6.0")]
public void ILLink_analyzer_warnings_are_produced_using_EnableSingleFileAnalyzer(string targetFramework)
{
@@ -743,7 +743,7 @@ public void It_errors_when_enabling_compression_targeting_net5()
.HaveStdOutContaining(Strings.CompressionInSingleFileRequires60);
}
- [RequiresMSBuildVersionFact("16.8.0")]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void It_errors_when_enabling_compression_without_selfcontained()
{
var testProject = new TestProject()
@@ -766,7 +766,7 @@ public void It_errors_when_enabling_compression_without_selfcontained()
.HaveStdOutContaining(Strings.CompressionInSingleFileRequiresSelfContained);
}
- [RequiresMSBuildVersionFact("16.8.0")]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void It_compresses_single_file_as_directed()
{
var testProject = new TestProject()
@@ -797,7 +797,7 @@ public void It_compresses_single_file_as_directed()
uncompressedSize.Should().BeGreaterThan(compressedSize);
}
- [RequiresMSBuildVersionFact("16.8.0")]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void It_does_not_compress_single_file_by_default()
{
var testProject = new TestProject()
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs
index b76fc3f2e57c..4f39656933dc 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishReadyToRun.cs
@@ -22,7 +22,7 @@ public GivenThatWeWantToPublishReadyToRun(ITestOutputHelper log) : base(log)
{
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("netcoreapp3.0")]
[InlineData("net5.0")]
[InlineData("net6.0")]
@@ -51,7 +51,7 @@ public void It_only_runs_readytorun_compiler_when_switch_is_enabled(string targe
publishDirectory.Should().HaveFile("System.Private.CoreLib.dll"); // self-contained
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("netcoreapp3.0")]
[InlineData("net5.0")]
[InlineData("net6.0")]
@@ -61,7 +61,7 @@ public void It_creates_readytorun_images_for_all_assemblies_except_excluded_ones
var testProject = CreateTestProjectForR2RTesting(
targetFramework,
- projectName,
+ projectName,
"ClassLib");
testProject.AdditionalProperties["PublishReadyToRun"] = "True";
@@ -73,7 +73,7 @@ public void It_creates_readytorun_images_for_all_assemblies_except_excluded_ones
publishCommand.Execute().Should().Pass();
DirectoryInfo publishDirectory = publishCommand.GetOutputDirectory(
- targetFramework,
+ targetFramework,
"Debug",
testProject.RuntimeIdentifier);
@@ -94,7 +94,7 @@ public void It_creates_readytorun_images_for_all_assemblies_except_excluded_ones
publishDirectory.Should().HaveFile("System.Private.CoreLib.dll"); // self-contained
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("netcoreapp3.0")]
[InlineData("net5.0")]
[InlineData("net6.0")]
@@ -103,7 +103,7 @@ public void It_creates_readytorun_symbols_when_switch_is_used(string targetFrame
TestProjectPublishing_Internal("CrossgenTest3", targetFramework, emitNativeSymbols: true, composite: false, identifier: targetFramework);
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("netcoreapp3.0")]
[InlineData("net5.0")]
[InlineData("net6.0")]
@@ -190,7 +190,7 @@ public void It_warns_when_targetting_netcoreapp_2_x_readytorun()
.HaveStdOutContaining(Strings.PublishReadyToRunRequiresVersion30);
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("netcoreapp3.0")]
[InlineData("net5.0")]
[InlineData("net6.0")]
@@ -199,7 +199,7 @@ public void It_can_publish_readytorun_for_library_projects(string targetFramewor
TestProjectPublishing_Internal("LibraryProject1", targetFramework, isSelfContained: false, makeExeProject: false, identifier: targetFramework);
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("netcoreapp3.0")]
[InlineData("net5.0")]
[InlineData("net6.0")]
@@ -208,7 +208,7 @@ public void It_can_publish_readytorun_for_selfcontained_library_projects(string
TestProjectPublishing_Internal("LibraryProject2", targetFramework, isSelfContained:true, makeExeProject: false, identifier: targetFramework);
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("net5.0")]
[InlineData("net6.0")]
void It_can_publish_readytorun_using_crossgen2(string targetFramework)
@@ -221,7 +221,7 @@ void It_can_publish_readytorun_using_crossgen2(string targetFramework)
TestProjectPublishing_Internal("Crossgen2TestApp", targetFramework, isSelfContained: true, emitNativeSymbols: true, useCrossgen2: true, composite: false, identifier: targetFramework);
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("net5.0")]
[InlineData("net6.0")]
void It_can_publish_readytorun_using_crossgen2_composite_mode(string targetFramework)
@@ -234,7 +234,7 @@ void It_can_publish_readytorun_using_crossgen2_composite_mode(string targetFrame
TestProjectPublishing_Internal("Crossgen2TestApp", targetFramework, isSelfContained: true, emitNativeSymbols: false, useCrossgen2: true, composite: true, identifier: targetFramework);
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("net5.0")]
[InlineData("net6.0")]
public void It_supports_libraries_when_using_crossgen2(string targetFramework)
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishTrimmedWindowsFormsAndWPFApps.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishTrimmedWindowsFormsAndWPFApps.cs
index c631b1a820cc..8992abe78780 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishTrimmedWindowsFormsAndWPFApps.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishTrimmedWindowsFormsAndWPFApps.cs
@@ -20,7 +20,7 @@ public GivenThatWeWantToPublishTrimmedWindowsFormsAndWPFApps(ITestOutputHelper l
{
}
- [WindowsOnlyFact]
+ [WindowsOnlyRequiresMSBuildVersionFact("17.0.0.32901")]
public void It_builds_windows_Forms_app_with_warning()
{
var targetFramework = "net6.0-windows";
@@ -42,7 +42,7 @@ public void It_builds_windows_Forms_app_with_warning()
.HaveStdOutContaining("NETSDK1175");
}
- [WindowsOnlyFact]
+ [WindowsOnlyRequiresMSBuildVersionFact("17.0.0.32901")]
public void It_builds_windows_Forms_app_with_warning_suppressed()
{
var targetFramework = "net6.0-windows";
@@ -66,8 +66,7 @@ public void It_builds_windows_Forms_app_with_warning_suppressed()
.NotHaveStdOutContaining(Strings.@TrimmingWindowsFormsIsNotSupported);
}
-
- [WindowsOnlyFact]
+ [WindowsOnlyRequiresMSBuildVersionFact("17.0.0.32901")]
public void It_publishes_windows_Forms_app_with_warning()
{
var targetFramework = "net6.0-windows";
@@ -91,7 +90,7 @@ public void It_publishes_windows_Forms_app_with_warning()
.HaveStdOutContaining("NETSDK1175");
}
- [WindowsOnlyFact]
+ [WindowsOnlyRequiresMSBuildVersionFact("17.0.0.32901")]
public void It_publishes_windows_Forms_app_with_warning_suppressed()
{
var targetFramework = "net6.0-windows";
@@ -118,7 +117,7 @@ public void It_publishes_windows_Forms_app_with_warning_suppressed()
.NotHaveStdOutContaining(Strings.@TrimmingWindowsFormsIsNotSupported);
}
- [WindowsOnlyFact]
+ [WindowsOnlyRequiresMSBuildVersionFact("17.0.0.32901")]
public void It_builds_wpf_app_with_warning()
{
var targetFramework = "net6.0-windows";
@@ -140,7 +139,7 @@ public void It_builds_wpf_app_with_warning()
.HaveStdOutContaining("NETSDK1168");
}
- [WindowsOnlyFact]
+ [WindowsOnlyRequiresMSBuildVersionFact("17.0.0.32901")]
public void It_builds_wpf_app_with_warning_Suppressed()
{
var targetFramework = "net6.0-windows";
@@ -165,7 +164,7 @@ public void It_builds_wpf_app_with_warning_Suppressed()
}
- [WindowsOnlyFact]
+ [WindowsOnlyRequiresMSBuildVersionFact("17.0.0.32901")]
public void It_publishes_wpf_app_with_warning()
{
var targetFramework = "net6.0-windows";
@@ -189,7 +188,7 @@ public void It_publishes_wpf_app_with_warning()
.HaveStdOutContaining("NETSDK1168");
}
- [WindowsOnlyFact]
+ [WindowsOnlyRequiresMSBuildVersionFact("17.0.0.32901")]
public void It_publishes_wpf_app_with_warning_Suppressed()
{
var targetFramework = "net6.0-windows";
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs
index 16f23e3399cb..4a9ccce84de7 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs
@@ -32,7 +32,7 @@ public GivenThatWeWantToRunILLink(ITestOutputHelper log) : base(log)
{
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void ILLink_only_runs_when_switch_is_enabled(string targetFramework)
{
@@ -66,7 +66,7 @@ public void ILLink_only_runs_when_switch_is_enabled(string targetFramework)
DoesDepsFileHaveAssembly(depsFile, unusedFrameworkAssembly).Should().BeTrue();
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("netcoreapp3.0", true)]
[InlineData("netcoreapp3.0", false)]
[InlineData("net5.0", false)]
@@ -107,7 +107,7 @@ public void ILLink_runs_and_creates_linked_app(string targetFramework, bool refe
DoesDepsFileHaveAssembly(depsFile, unusedFrameworkAssembly).Should().BeFalse();
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void ILLink_links_simple_app_without_analysis_warnings_and_it_runs(string targetFramework)
{
@@ -134,7 +134,7 @@ public void ILLink_links_simple_app_without_analysis_warnings_and_it_runs(string
}
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void PrepareForILLink_can_set_IsTrimmable(string targetFramework)
{
@@ -159,7 +159,7 @@ public void PrepareForILLink_can_set_IsTrimmable(string targetFramework)
File.Exists(unusedIsTrimmableDll).Should().BeFalse();
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net5Plus), MemberType = typeof(PublishTestUtils))]
public void PrepareForILLink_can_set_TrimMode(string targetFramework)
{
@@ -184,7 +184,7 @@ public void PrepareForILLink_can_set_TrimMode(string targetFramework)
File.Exists(unusedTrimModeLinkDll).Should().BeFalse();
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("net5.0", "link")]
[InlineData("net6.0", "copyused")]
public void ILLink_respects_global_TrimMode(string targetFramework, string trimMode)
@@ -219,7 +219,7 @@ public void ILLink_respects_global_TrimMode(string targetFramework, string trimM
}
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net5Plus), MemberType = typeof(PublishTestUtils))]
public void ILLink_roots_IntermediateAssembly(string targetFramework)
{
@@ -243,7 +243,7 @@ public void ILLink_roots_IntermediateAssembly(string targetFramework)
DoesImageHaveMethod(publishedDll, "Main").Should().BeTrue();
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData(LatestTfm)]
public void ILLink_respects_TrimmableAssembly(string targetFramework)
{
@@ -268,7 +268,7 @@ public void ILLink_respects_TrimmableAssembly(string targetFramework)
File.Exists(unusedTrimmableDll).Should().BeFalse();
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net6Plus), MemberType = typeof(PublishTestUtils))]
public void ILLink_respects_IsTrimmable_attribute(string targetFramework)
{
@@ -290,7 +290,7 @@ public void ILLink_respects_IsTrimmable_attribute(string targetFramework)
DoesImageHaveMethod(unusedNonTrimmableDll, "UnusedMethod").Should().BeTrue();
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net6Plus), MemberType = typeof(PublishTestUtils))]
public void ILLink_IsTrimmable_metadata_can_override_attribute(string targetFramework)
{
@@ -315,7 +315,7 @@ public void ILLink_IsTrimmable_metadata_can_override_attribute(string targetFram
File.Exists(unusedNonTrimmableDll).Should().BeFalse();
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net6Plus), MemberType = typeof(PublishTestUtils))]
public void ILLink_TrimMode_applies_to_IsTrimmable_assemblies(string targetFramework)
{
@@ -343,7 +343,7 @@ public void ILLink_TrimMode_applies_to_IsTrimmable_assemblies(string targetFrame
DoesImageHaveMethod(unusedNonTrimmableDll, "UnusedMethod").Should().BeTrue();
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData(LatestTfm)]
public void ILLink_can_set_TrimmerDefaultAction(string targetFramework)
{
@@ -371,7 +371,7 @@ public void ILLink_can_set_TrimmerDefaultAction(string targetFramework)
File.Exists(unusedNonTrimmableDll).Should().BeFalse();
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("net5.0")]
public void ILLink_analysis_warnings_are_disabled_by_default(string targetFramework)
{
@@ -389,7 +389,7 @@ public void ILLink_analysis_warnings_are_disabled_by_default(string targetFramew
.And.NotHaveStdOutMatching(@"warning IL\d\d\d\d");
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net6Plus), MemberType = typeof(PublishTestUtils))]
public void ILLink_analysis_warnings_are_enabled_by_default(string targetFramework)
{
@@ -411,7 +411,7 @@ public void ILLink_analysis_warnings_are_enabled_by_default(string targetFramewo
.And.HaveStdOutMatching("warning IL2093.*Program.Derived.IL_2093");
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net5Plus), MemberType = typeof(PublishTestUtils))]
public void ILLink_accepts_option_to_enable_analysis_warnings(string targetFramework)
{
@@ -433,7 +433,7 @@ public void ILLink_accepts_option_to_enable_analysis_warnings(string targetFrame
.And.HaveStdOutMatching("warning IL2093.*Program.Derived.IL_2093");
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net5Plus), MemberType = typeof(PublishTestUtils))]
public void ILLink_accepts_option_to_disable_analysis_warnings(string targetFramework)
{
@@ -455,7 +455,7 @@ public void ILLink_accepts_option_to_disable_analysis_warnings(string targetFram
.And.NotHaveStdOutContaining("warning IL2093");
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net5Plus), MemberType = typeof(PublishTestUtils))]
public void ILLink_accepts_option_to_enable_analysis_warnings_without_PublishTrimmed(string targetFramework)
{
@@ -474,7 +474,7 @@ public void ILLink_accepts_option_to_enable_analysis_warnings_without_PublishTri
.And.HaveStdOutMatching("warning IL2026.*Program.IL_2026.*Testing analysis warning IL2026");
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData(LatestTfm)]
public void ILLink_shows_single_warning_for_packagereferences_only(string targetFramework)
{
@@ -497,7 +497,7 @@ public void ILLink_shows_single_warning_for_packagereferences_only(string target
.And.NotHaveStdOutMatching("IL2104.*'TransitiveProjectReference'");
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData(LatestTfm)]
public void ILLink_accepts_option_to_show_all_warnings(string targetFramework)
{
@@ -517,7 +517,7 @@ public void ILLink_accepts_option_to_show_all_warnings(string targetFramework)
.And.NotHaveStdOutContaining("IL2104");
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData(LatestTfm)]
public void ILLink_can_show_single_warning_per_assembly(string targetFramework)
{
@@ -545,7 +545,7 @@ public void ILLink_can_show_single_warning_per_assembly(string targetFramework)
.And.NotHaveStdOutMatching("IL2104.*'TransitiveProjectReference'");
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void ILLink_errors_fail_the_build(string targetFramework)
{
@@ -581,7 +581,7 @@ public void ILLink_errors_fail_the_build(string targetFramework)
File.Exists(publishedDll).Should().BeFalse();
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData(LatestTfm)]
public void ILLink_verify_analysis_warnings_hello_world_app_trim_mode_copyused(string targetFramework)
{
@@ -607,7 +607,7 @@ public void ILLink_verify_analysis_warnings_hello_world_app_trim_mode_copyused(s
ValidateWarningsOnHelloWorldApp(publishCommand, result, expectedOutput, targetFramework, rid);
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData(LatestTfm)]
public void ILLink_verify_analysis_warnings_hello_world_app_trim_mode_link(string targetFramework)
{
@@ -656,7 +656,7 @@ private void ValidateWarningsOnHelloWorldApp (PublishCommand publishCommand, Com
Assert.True(!extraWarnings.Any(), errorMessage.ToString());
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void TrimmingOptions_are_defaulted_correctly_on_trimmed_apps(string targetFramework)
{
@@ -713,7 +713,7 @@ public void TrimmingOptions_are_defaulted_correctly_on_trimmed_apps(string targe
}
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void ILLink_accepts_root_descriptor(string targetFramework)
{
@@ -748,7 +748,7 @@ public void ILLink_accepts_root_descriptor(string targetFramework)
DoesImageHaveMethod(unusedDll, "UnusedMethodToRoot").Should().BeTrue();
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("_TrimmerBeforeFieldInit")]
[InlineData("_TrimmerOverrideRemoval")]
[InlineData("_TrimmerUnreachableBodies")]
@@ -769,7 +769,7 @@ public void ILLink_error_on_nonboolean_optimization_flag(string property)
.Should().Fail().And.HaveStdOutContaining("MSB4030");
}
- [RequiresMSBuildVersionFact("16.8.0")]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void ILLink_respects_feature_settings_from_host_config()
{
var projectName = "HelloWorld";
@@ -802,7 +802,7 @@ public void ILLink_respects_feature_settings_from_host_config()
DoesImageHaveMethod(referenceDll, "FeatureImplementation").Should().BeFalse();
}
- [RequiresMSBuildVersionFact("16.8.0")]
+ [RequiresMSBuildVersionFact("17.0.0.32901")]
public void ILLink_ignores_host_config_settings_with_link_false()
{
var projectName = "HelloWorld";
@@ -835,7 +835,7 @@ public void ILLink_ignores_host_config_settings_with_link_false()
DoesImageHaveMethod(referenceDll, "FeatureImplementation").Should().BeTrue();
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void ILLink_runs_incrementally(string targetFramework)
{
@@ -864,7 +864,7 @@ public void ILLink_runs_incrementally(string targetFramework)
semaphoreFirstModifiedTime.Should().Be(semaphoreSecondModifiedTime);
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void ILLink_defaults_keep_nonframework(string targetFramework)
{
@@ -900,7 +900,7 @@ public void ILLink_defaults_keep_nonframework(string targetFramework)
DoesDepsFileHaveAssembly(depsFile, unusedFrameworkAssembly).Should().BeFalse();
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void ILLink_does_not_include_leftover_artifacts_on_second_run(string targetFramework)
{
@@ -953,7 +953,7 @@ public void ILLink_does_not_include_leftover_artifacts_on_second_run(string targ
Directory.Exists(Path.Combine(publishDirectory, "linked")).Should().BeFalse();
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void ILLink_keeps_symbols_by_default(string targetFramework)
{
@@ -986,7 +986,7 @@ public void ILLink_keeps_symbols_by_default(string targetFramework)
publishPdbSize.Should().Be(linkedPdbSize);
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void ILLink_removes_symbols_when_debugger_support_is_disabled(string targetFramework)
{
@@ -1014,7 +1014,7 @@ public void ILLink_removes_symbols_when_debugger_support_is_disabled(string targ
File.Exists(publishedPdb).Should().BeFalse();
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void ILLink_accepts_option_to_remove_symbols(string targetFramework)
{
@@ -1042,7 +1042,7 @@ public void ILLink_accepts_option_to_remove_symbols(string targetFramework)
File.Exists(publishedPdb).Should().BeFalse();
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void ILLink_symbols_option_can_override_defaults_from_debugger_support(string targetFramework)
{
@@ -1076,7 +1076,7 @@ public void ILLink_symbols_option_can_override_defaults_from_debugger_support(st
publishPdbSize.Should().Be(linkedPdbSize);
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net5Plus), MemberType = typeof(PublishTestUtils))]
public void ILLink_can_treat_warnings_as_errors(string targetFramework)
{
@@ -1094,7 +1094,7 @@ public void ILLink_can_treat_warnings_as_errors(string targetFramework)
.And.HaveStdOutContaining("warning IL2026");
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net5Plus), MemberType = typeof(PublishTestUtils))]
public void ILLink_can_treat_warnings_not_as_errors(string targetFramework)
{
@@ -1117,7 +1117,7 @@ public void ILLink_can_treat_warnings_not_as_errors(string targetFramework)
.And.HaveStdOutContaining("warning IL2075");
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net5Plus), MemberType = typeof(PublishTestUtils))]
public void ILLink_can_ignore_warnings(string targetFramework)
{
@@ -1136,7 +1136,7 @@ public void ILLink_can_ignore_warnings(string targetFramework)
.And.HaveStdOutContaining("warning IL2026");
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net5Plus), MemberType = typeof(PublishTestUtils))]
public void ILLink_respects_analysis_level(string targetFramework)
{
@@ -1152,7 +1152,7 @@ public void ILLink_respects_analysis_level(string targetFramework)
.Should().Pass().And.NotHaveStdOutMatching(@"warning IL\d\d\d\d");
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net5Plus), MemberType = typeof(PublishTestUtils))]
public void ILLink_respects_warning_level_independently(string targetFramework)
{
@@ -1169,7 +1169,7 @@ public void ILLink_respects_warning_level_independently(string targetFramework)
.And.NotHaveStdOutContaining("warning IL2075");
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(Net5Plus), MemberType = typeof(PublishTestUtils))]
public void ILLink_can_treat_warnings_as_errors_independently(string targetFramework)
{
@@ -1192,7 +1192,7 @@ public void ILLink_can_treat_warnings_as_errors_independently(string targetFrame
.And.HaveStdOutContaining("warning IL2075");
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void ILLink_error_on_portable_app(string targetFramework)
{
@@ -1208,7 +1208,7 @@ public void ILLink_error_on_portable_app(string targetFramework)
.And.HaveStdOutContaining(Strings.ILLinkNotSupportedError);
}
- [Theory]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[MemberData(nameof(SupportedTfms), MemberType = typeof(PublishTestUtils))]
public void ILLink_displays_informational_warning(string targetFramework)
{
@@ -1267,7 +1267,7 @@ static void Main() {}
GivenThatWeWantToPublishReadyToRun.DoesImageHaveR2RInfo(publishDir.File("TestWeb.Views.dll").FullName);
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData("net6.0", true)]
[InlineData("net6.0", false)]
public void Build_respects_IsTrimmable_property(string targetFramework, bool isExe)
@@ -1301,7 +1301,7 @@ public void Build_respects_IsTrimmable_property(string targetFramework, bool isE
}
}
- [RequiresMSBuildVersionTheory("16.8.0")]
+ [RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData(LatestTfm)]
public void Build_respects_PublishTrimmed_property(string targetFramework)
{
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/PublishWpfApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/PublishWpfApp.cs
index 771e7d780475..3b1c6764e7f8 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/PublishWpfApp.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/PublishWpfApp.cs
@@ -18,7 +18,7 @@ public PublishWpfApp(ITestOutputHelper log) : base(log)
{
}
- [WindowsOnlyRequiresMSBuildVersionFact("16.8.0")]
+ [WindowsOnlyRequiresMSBuildVersionFact("17.0.0.32901")]
public void It_publishes_and_runs_self_contained_wpf_app()
{
var testDir = _testAssetsManager.CreateTestDirectory();
diff --git a/src/WebSdk/Web/Sdk/Sdk.props b/src/WebSdk/Web/Sdk/Sdk.props
index d695147620bd..daba9686b6ec 100644
--- a/src/WebSdk/Web/Sdk/Sdk.props
+++ b/src/WebSdk/Web/Sdk/Sdk.props
@@ -58,4 +58,18 @@ Copyright (c) .NET Foundation. All rights reserved.
IsImplicitlyDefined="true" />
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WebSdk/Web/Sdk/Sdk.targets b/src/WebSdk/Web/Sdk/Sdk.targets
index 71fd818040e9..d1cee3c9fa9d 100644
--- a/src/WebSdk/Web/Sdk/Sdk.targets
+++ b/src/WebSdk/Web/Sdk/Sdk.targets
@@ -22,6 +22,7 @@ Copyright (c) .NET Foundation. All rights reserved.
Microsoft.AspNetCore.App. This needs to happen after the .NET SDK has evaluated TFMs.
-->
true
+ false
diff --git a/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.props b/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.props
index d163113e3c34..4fb1d8048d0e 100644
--- a/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.props
+++ b/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.props
@@ -38,6 +38,15 @@ Copyright (c) .NET Foundation. All rights reserved.
<_ContentIncludedByDefault Include="@(Content)" />
+
+
+
+
+
+
+
diff --git a/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.targets b/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.targets
index 8816f8d7b1d8..fa431d9289b6 100644
--- a/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.targets
+++ b/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.targets
@@ -14,6 +14,7 @@ Copyright (c) .NET Foundation. All rights reserved.
true
$(MSBuildProjectDirectory)
+ false