From e21972ad83cb953a9dbf4ed6f7ec6ca86496c949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 2 Dec 2024 15:55:05 +0100 Subject: [PATCH] Remove test workaround that alters Sdk targets (#4205) (#4216) Co-authored-by: Youssef Victor --- .../MSBuildTests.Solution.cs | 231 ------------------ 1 file changed, 231 deletions(-) diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Solution.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Solution.cs index e004a8ced4..7ad84c074d 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Solution.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Solution.cs @@ -11,28 +11,9 @@ public class MSBuildTests_Solution : AcceptanceTestBase private readonly AcceptanceFixture _acceptanceFixture; private const string AssetName = "MSTestProject"; - static MSBuildTests_Solution() - { - string dotnetMuxerSDK = Directory.GetDirectories(Path.Combine(RootFinder.Find(), ".dotnet", "sdk")).OrderByDescending(x => x).First(); - File.WriteAllText(Path.Combine(dotnetMuxerSDK, "Microsoft.Common.CrossTargeting.targets"), MicrosoftCommonCrossTargeting); - if (!File.Exists(Path.Combine(dotnetMuxerSDK, "Microsoft.Common.Test.targets"))) - { - File.WriteAllText(Path.Combine(dotnetMuxerSDK, "Microsoft.Common.Test.targets"), MicrosoftCommonTesttargets); - } - } - public MSBuildTests_Solution(ITestExecutionContext testExecutionContext, AcceptanceFixture acceptanceFixture) : base(testExecutionContext) => _acceptanceFixture = acceptanceFixture; - private void CheckPatch() - { - // https://github.com/dotnet/sdk/issues/37712 - if (DateTime.UtcNow.Date > new DateTime(2024, 12, 1)) - { - throw new InvalidOperationException("Check if we can remove the patch!"); - } - } - internal static IEnumerable> GetBuildMatrix() { foreach (TestArgumentsEntry<(string SingleTfmOrMultiTfm, BuildConfiguration BuildConfiguration, bool IsMultiTfm)> entry in GetBuildMatrixSingleAndMultiTfmBuildConfiguration()) @@ -52,8 +33,6 @@ private void CheckPatch() [ArgumentsProvider(nameof(GetBuildMatrix))] public async Task MSBuildTests_UseMSBuildTestInfrastructure_Should_Run_Solution_Tests(string singleTfmOrMultiTfm, BuildConfiguration _, bool isMultiTfm, string command) { - CheckPatch(); - using TestAsset generator = await TestAsset.GenerateAssetAsync( AssetName, SourceCode @@ -155,215 +134,5 @@ public void TestMethod1() global using Microsoft.Testing.Platform.Builder; global using Microsoft.Testing.Internal.Framework; global using Microsoft.Testing.Platform.MSBuild; -"""; - - private const string MicrosoftCommonCrossTargeting = """ - - - - true - true - - - - - - - - - - <_ThisProjectBuildMetadata Include="$(MSBuildProjectFullPath)"> - @(_TargetFrameworkInfo) - @(_TargetFrameworkInfo->'%(TargetFrameworkMonikers)') - @(_TargetFrameworkInfo->'%(TargetPlatformMonikers)') - $(_AdditionalPropertiesFromProject) - false - @(_TargetFrameworkInfo->'%(IsRidAgnostic)') - - - false - $(Platform) - $(Platforms) - - - - - - <_TargetFramework Include="$(TargetFrameworks)" /> - - <_TargetFrameworkNormalized Include="@(_TargetFramework->Trim()->Distinct())" /> - <_InnerBuildProjects Include="$(MSBuildProjectFile)"> - TargetFramework=%(_TargetFrameworkNormalized.Identity) - - - - - - - - - - - - true - - - - - - - - - - - - - Build - - - - - - - - - - - - $([MSBuild]::IsRunningFromVisualStudio()) - $([MSBuild]::GetToolsDirectory32())\..\..\..\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets - $(MSBuildToolsPath)\NuGet.targets - - - - - - true - - - - - true - - - - true - - - - <_DirectoryBuildTargetsFile Condition="'$(_DirectoryBuildTargetsFile)' == ''">Directory.Build.targets - <_DirectoryBuildTargetsBasePath Condition="'$(_DirectoryBuildTargetsBasePath)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), '$(_DirectoryBuildTargetsFile)')) - $([System.IO.Path]::Combine('$(_DirectoryBuildTargetsBasePath)', '$(_DirectoryBuildTargetsFile)')) - - - - false - - - -"""; - - private const string MicrosoftCommonTesttargets = """ - - - """; }