From cf980e68307307363fe9cc344931e20eb5e5ef18 Mon Sep 17 00:00:00 2001 From: Ruben Guerrero Date: Thu, 2 Mar 2023 11:02:48 -0800 Subject: [PATCH] Microsoft.Management.Configuration Windows target platform (#3032) Move Microsoft.Management.Configuration projects to target 10.0.19041.0. Fix UTs Microsoft.Management.Configuration flaky tests. --- .../Microsoft.Management.Configuration.Processor.csproj | 4 ++-- .../Microsoft.Management.Configuration.Projection.csproj | 4 ++-- .../Helpers/TempFile.cs | 2 +- .../Tests/ConfigurationDetailsTests.cs | 4 ++-- .../Microsoft.Management.Configuration.vcxproj | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.Management.Configuration.Processor/Microsoft.Management.Configuration.Processor.csproj b/src/Microsoft.Management.Configuration.Processor/Microsoft.Management.Configuration.Processor.csproj index e753f77e7e..63bb751b0d 100644 --- a/src/Microsoft.Management.Configuration.Processor/Microsoft.Management.Configuration.Processor.csproj +++ b/src/Microsoft.Management.Configuration.Processor/Microsoft.Management.Configuration.Processor.csproj @@ -1,7 +1,7 @@  - net6.0-windows10.0.22000.0 + net6.0-windows10.0.19041.0 enable 10.0.17763.0 x64;x86;arm64 @@ -19,7 +19,7 @@ true - 10.0.22000.0 + 10.0.19041.0 diff --git a/src/Microsoft.Management.Configuration.Projection/Microsoft.Management.Configuration.Projection.csproj b/src/Microsoft.Management.Configuration.Projection/Microsoft.Management.Configuration.Projection.csproj index 7af8ddd0e6..c586c79cf8 100644 --- a/src/Microsoft.Management.Configuration.Projection/Microsoft.Management.Configuration.Projection.csproj +++ b/src/Microsoft.Management.Configuration.Projection/Microsoft.Management.Configuration.Projection.csproj @@ -1,7 +1,7 @@ - net6.0-windows10.0.22000.0 + net6.0-windows10.0.19041.0 x64;x86;arm64 enable enable @@ -11,7 +11,7 @@ Microsoft.Management.Configuration $(OutDir) - 10.0.22000.0 + 10.0.19041.0 10.0.17763.0 diff --git a/src/Microsoft.Management.Configuration.UnitTests/Helpers/TempFile.cs b/src/Microsoft.Management.Configuration.UnitTests/Helpers/TempFile.cs index 4b3dfa83d6..5306472683 100644 --- a/src/Microsoft.Management.Configuration.UnitTests/Helpers/TempFile.cs +++ b/src/Microsoft.Management.Configuration.UnitTests/Helpers/TempFile.cs @@ -81,7 +81,7 @@ public void CreateFile(string? content = null) { if (content is null) { - File.Create(this.FullFileName); + using var fs = File.Create(this.FullFileName); } else { diff --git a/src/Microsoft.Management.Configuration.UnitTests/Tests/ConfigurationDetailsTests.cs b/src/Microsoft.Management.Configuration.UnitTests/Tests/ConfigurationDetailsTests.cs index 5b4500fb43..7d6c648e56 100644 --- a/src/Microsoft.Management.Configuration.UnitTests/Tests/ConfigurationDetailsTests.cs +++ b/src/Microsoft.Management.Configuration.UnitTests/Tests/ConfigurationDetailsTests.cs @@ -185,8 +185,8 @@ private ConfigurationUnit CreteConfigurationUnit() private (DscResourceInfoInternal dscResourceInfo, PSModuleInfo psModuleInfo) GetResourceAndModuleInfo(ConfigurationUnit unit) { // This is easier than trying to mock sealed class from external code... - var testEnv = this.fixture.PrepareTestProcessorEnvironment(); - testEnv.ValidateRunspace(); + var testEnv = this.fixture.PrepareTestProcessorEnvironment(true); + var dscResourceInfo = testEnv.GetDscResource(new ConfigurationUnitInternal(unit, null)); var psModuleInfo = testEnv.GetAvailableModule(PowerShellHelpers.CreateModuleSpecification("xSimpleTestResource", "0.0.0.1")); diff --git a/src/Microsoft.Management.Configuration/Microsoft.Management.Configuration.vcxproj b/src/Microsoft.Management.Configuration/Microsoft.Management.Configuration.vcxproj index 80df710d4b..e68f313923 100644 --- a/src/Microsoft.Management.Configuration/Microsoft.Management.Configuration.vcxproj +++ b/src/Microsoft.Management.Configuration/Microsoft.Management.Configuration.vcxproj @@ -12,7 +12,7 @@ en-US 14.0 10.0 - 10.0.22000.0 + 10.0.19041.0 10.0.17763.0 true true