Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix updating KnownWebAssemblySdkPack when creating test layout #44888

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.DotNet.Build.Tasks
/// <summary>
/// Use the runtime in dotnet/sdk instead of in the stage 0 to avoid circular dependency.
/// If there is a change depended on the latest runtime. Without override the runtime version in BundledNETCoreAppPackageVersion
/// we would need to somehow get this change in without the test, and then insertion dotnet/installer
/// we would need to somehow get this change in without the test, and then insertion dotnet/sdk
/// and then update the stage 0 back.
///
/// Override NETCoreSdkVersion to stage 0 sdk version like 6.0.100-dev
Expand All @@ -21,7 +21,7 @@ public sealed class OverrideAndCreateBundledNETCoreAppPackageVersion : Task
{
private static string _messageWhenMismatch =
"{0} version {1} does not match BundledNETCoreAppPackageVersion {2}. " +
"The schema of https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateBundledVersions.targets might change. " +
"The schema of https://github.com/dotnet/sdk/blob/main/src/Installer/redist-installer/targets/GenerateBundledVersions.targets might change. " +
"We need to ensure we can swap the runtime version from what's in stage0 to what dotnet/sdk used successfully";

[Required] public string Stage0MicrosoftNETCoreAppRefPackageVersionPath { get; set; }
Expand Down Expand Up @@ -51,7 +51,7 @@ public static string ExecuteInternal(

var ns = projectXml.Root.Name.Namespace;

var propertyGroup = projectXml.Root.Elements(ns + "PropertyGroup").First();
var propertyGroup = projectXml.Root.Elements(ns + "PropertyGroup").First();

propertyGroup.Element(ns + "NETCoreSdkVersion").Value = newSDKVersion;

Expand Down Expand Up @@ -118,17 +118,28 @@ void CheckAndReplaceAttribute(XAttribute attribute)

CheckAndReplaceAttribute(itemGroup
.Elements(ns + "KnownFrameworkReference").First().Attribute("LatestRuntimeFrameworkVersion"));
CheckAndReplaceAttribute(itemGroup
.Elements(ns + "KnownAppHostPack").First().Attribute("AppHostPackVersion"));
CheckAndReplaceAttribute(itemGroup
.Elements(ns + "KnownCrossgen2Pack").First().Attribute("Crossgen2PackVersion"));
CheckAndReplaceAttribute(itemGroup
.Elements(ns + "KnownILCompilerPack").First().Attribute("ILCompilerPackVersion"));
CheckAndReplaceAttribute(itemGroup
.Elements(ns + "KnownILLinkPack").First().Attribute("ILLinkPackVersion"));

CheckAndReplaceAttribute(itemGroup
.Elements(ns + "KnownRuntimePack").First().Attribute("LatestRuntimeFrameworkVersion"));
(string Name, string VersionAttribute)[] knownPacksAndVersionAttribute = {
("KnownAppHostPack", "AppHostPackVersion"),
("KnownCrossgen2Pack", "Crossgen2PackVersion"),
("KnownILCompilerPack", "ILCompilerPackVersion"),
("KnownILLinkPack", "ILLinkPackVersion"),
("KnownWebAssemblySdkPack", "WebAssemblySdkPackVersion"),
("KnownRuntimePack", "LatestRuntimeFrameworkVersion"),
};

// update all Known*Pack elements
foreach (var item in knownPacksAndVersionAttribute)
{
CheckAndReplaceAttribute(itemGroup.Elements(ns + item.Name).First().Attribute(item.VersionAttribute));
}

// check that we didn't miss any Known*Pack elements
foreach (var item in itemGroup.Elements().Where(i => i.Name.LocalName.StartsWith("Known") && i.Name.LocalName.EndsWith("Pack")))
{
if (!knownPacksAndVersionAttribute.Any(p => p.Name == item.Name.LocalName))
throw new InvalidOperationException($"Unexpected Known*Pack element: {item.Name.LocalName}");
}

return projectXml.ToString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Copyright (c) .NET Foundation. All rights reserved.

<!-- This file contains a list of the windows target platform versions that are supported by this SDK for .NET. Supported versions are processed in _NormalizeTargetPlatformVersion -->
<Project>
<!-- These will be added to the BundledVersions.props that's generated in dotnet/installer. So only add them here if we don't have that change yet -->

<!-- These will be added to the BundledVersions.props that's generated in dotnet/sdk. So only add them here if we don't have that change yet -->
<ItemGroup Condition="'@(WindowsSdkSupportedTargetPlatformVersion)' == ''">
<WindowsSdkSupportedTargetPlatformVersion Include="10.0.19041.0" WindowsSdkPackageVersion="10.0.19041.16" MinimumNETVersion="5.0" />
<WindowsSdkSupportedTargetPlatformVersion Include="10.0.18362.0" WindowsSdkPackageVersion="10.0.18362.16" MinimumNETVersion="5.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ public class BlazorLegacyIntegrationTest60(ITestOutputHelper log)
: IsolatedNuGetPackageFolderAspNetSdkBaselineTest(log, nameof(BlazorLegacyIntegrationTest60))
{

protected override string EmbeddedResourcePrefix =>
protected override string EmbeddedResourcePrefix =>
string.Join('.', "Microsoft.NET.Sdk.BlazorWebAssembly.Tests", "StaticWebAssetsBaselines");

protected override string ComputeBaselineFolder() =>
Path.Combine(TestContext.GetRepoRoot() ?? AppContext.BaseDirectory, "test", "Microsoft.NET.Sdk.BlazorWebAssembly.Tests", "StaticWebAssetsBaselines");

[CoreMSBuildOnlyFact]
public void Build60Hosted_Works()
{
Expand Down Expand Up @@ -44,7 +44,7 @@ public void Build60Hosted_Works()
new FileInfo(Path.Combine(serverBuildOutputDirectory, $"{testAsset}.Shared.dll")).Should().Exist();
}

[WindowsOnlyRequiresMSBuildVersionFact("17.13", Reason = "Needs System.Text.Json 8.0.5")] // https://github.com/dotnet/sdk/issues/44886
[Fact]
[SkipOnPlatform(TestPlatforms.Linux | TestPlatforms.OSX, "https://github.com/dotnet/sdk/issues/42145")]
public void Publish60Hosted_Works()
{
Expand Down
Loading