|
17 | 17 | using Xunit.Abstractions; |
18 | 18 | using Microsoft.NET.TestFramework.ProjectConstruction; |
19 | 19 | using Newtonsoft.Json.Linq; |
| 20 | +using NuGet.Versioning; |
20 | 21 |
|
21 | 22 | namespace Microsoft.NET.Build.Tests |
22 | 23 | { |
@@ -188,7 +189,7 @@ public void It_creates_a_documentation_file(string language) |
188 | 189 | [InlineData("vb", false)] |
189 | 190 | public void It_allows_us_to_override_the_documentation_file_name(string language, bool setGenerateDocumentationFileProperty) |
190 | 191 | { |
191 | | - var testAsset = CreateDocumentationFileLibraryAsset(setGenerateDocumentationFileProperty ? (bool?)true : null, "TestLibDoc.xml", language, "OverrideDocFileName"); |
| 192 | + var testAsset = CreateDocumentationFileLibraryAsset(setGenerateDocumentationFileProperty ? (bool?)true : null, "TestLibDoc.xml", language, "OverrideDocFileName"); |
192 | 193 |
|
193 | 194 | var libraryProjectDirectory = Path.Combine(testAsset.TestRoot, "TestLibrary"); |
194 | 195 |
|
@@ -217,7 +218,8 @@ public void It_allows_us_to_override_the_documentation_file_name(string language |
217 | 218 | }; |
218 | 219 |
|
219 | 220 | // vb uses DocumentationFile relative to the IntermediateOutputPath |
220 | | - if (language != "vb") { |
| 221 | + if (language != "vb") |
| 222 | + { |
221 | 223 | expectedProjectDirectoryFiles.Add("TestLibDoc.xml"); |
222 | 224 | } |
223 | 225 |
|
@@ -391,6 +393,11 @@ public void It_implicitly_defines_compilation_constants_for_the_target_framework |
391 | 393 | [InlineData(new[] { "11.11", "12.12", "13.13" }, "android", "12.12", new[] { "ANDROID", "ANDROID12_12", "ANDROID11_11_OR_GREATER", "ANDROID12_12_OR_GREATER" })] |
392 | 394 | public void It_implicitly_defines_compilation_constants_for_the_target_platform(string[] sdkSupportedTargetPlatformVersion, string targetPlatformIdentifier, string targetPlatformVersion, string[] expectedDefines) |
393 | 395 | { |
| 396 | + // Skip Test if SDK is < 7.0.200 |
| 397 | + var sdkVersion = SemanticVersion.Parse(TestContext.Current.ToolsetUnderTest.SdkVersion); |
| 398 | + if (new SemanticVersion(sdkVersion.Major, sdkVersion.Minor, sdkVersion.Patch) < new SemanticVersion(7, 0, 200)) |
| 399 | + return; // Fixed by https://github.com/dotnet/sdk/pull/29009 |
| 400 | + |
394 | 401 | var targetFramework = "net5.0"; |
395 | 402 | var testAsset = _testAssetsManager |
396 | 403 | .CopyTestAsset("AppWithLibrary", "ImplicitFrameworkConstants", targetFramework, identifier: expectedDefines.GetHashCode().ToString()) |
@@ -424,7 +431,7 @@ public void It_implicitly_defines_compilation_constants_for_the_target_platform( |
424 | 431 | }); |
425 | 432 |
|
426 | 433 | AssertDefinedConstantsOutput(testAsset, targetFramework, |
427 | | - new[] { "NETCOREAPP", "NETCOREAPP1_0_OR_GREATER", "NETCOREAPP1_1_OR_GREATER", "NETCOREAPP2_0_OR_GREATER", "NETCOREAPP2_1_OR_GREATER", "NETCOREAPP2_2_OR_GREATER", "NETCOREAPP3_0_OR_GREATER", "NETCOREAPP3_1_OR_GREATER", "NET", "NET5_0", "NET5_0_OR_GREATER" } |
| 434 | + new[] { "NETCOREAPP", "NETCOREAPP1_0_OR_GREATER", "NETCOREAPP1_1_OR_GREATER", "NETCOREAPP2_0_OR_GREATER", "NETCOREAPP2_1_OR_GREATER", "NETCOREAPP2_2_OR_GREATER", "NETCOREAPP3_0_OR_GREATER", "NETCOREAPP3_1_OR_GREATER", "NET", "NET5_0", "NET5_0_OR_GREATER" } |
428 | 435 | .Concat(expectedDefines).ToArray()); |
429 | 436 | } |
430 | 437 |
|
@@ -920,7 +927,7 @@ public void It_can_build_with_dynamic_loading_enabled(string targetFramework, st |
920 | 927 | testProject.AdditionalProperties["CopyLocalLockFileAssemblies"] = copyLocal.ToString().ToLower(); |
921 | 928 | } |
922 | 929 |
|
923 | | - var identifier = targetFramework + shouldSetRollForward + shouldCopyLocal + (rollForwardValue == null? "Null" : rollForwardValue); |
| 930 | + var identifier = targetFramework + shouldSetRollForward + shouldCopyLocal + (rollForwardValue == null ? "Null" : rollForwardValue); |
924 | 931 | var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: identifier); |
925 | 932 |
|
926 | 933 | var buildCommand = new BuildCommand(testAsset); |
@@ -949,7 +956,7 @@ public void It_can_build_with_dynamic_loading_enabled(string targetFramework, st |
949 | 956 | string runtimeConfigFile = Path.Combine(outputDirectory.FullName, runtimeConfigName); |
950 | 957 | string runtimeConfigContents = File.ReadAllText(runtimeConfigFile); |
951 | 958 | JObject runtimeConfig = JObject.Parse(runtimeConfigContents); |
952 | | - JToken rollForward= runtimeConfig["runtimeOptions"]["rollForward"]; |
| 959 | + JToken rollForward = runtimeConfig["runtimeOptions"]["rollForward"]; |
953 | 960 | if (shouldSetRollForward) |
954 | 961 | { |
955 | 962 | rollForward.Value<string>().Should().Be(string.IsNullOrEmpty(rollForwardValue) ? "LatestMinor" : rollForwardValue); |
@@ -990,7 +997,7 @@ public class ProjectNameWithSpacesClass |
990 | 997 | }"); |
991 | 998 | string projectFolder = Path.Combine(testAsset.Path, testProject.Name); |
992 | 999 |
|
993 | | - var buildCommand = new BuildCommand(testAsset, $"{ testProject.Name}"); |
| 1000 | + var buildCommand = new BuildCommand(testAsset, $"{testProject.Name}"); |
994 | 1001 | buildCommand |
995 | 1002 | .Execute() |
996 | 1003 | .Should() |
|
0 commit comments