From 8e5533f2a3bce929607fd4cc908db1ac8e44cbf7 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 11 Aug 2020 10:29:01 -0700 Subject: [PATCH] Use BlazorWebAssemblySDK (#24371) * Use BlazorWebAssemblySDK * Update projects to use the BlazorSDK * Remove tasks and targets from RazorSDK * Remove workarounds from BlazorSDK * Fixup * Fixup --- eng/targets/CSharp.Common.props | 21 +- src/Components/Directory.Build.targets | 4 +- .../WasmPublishIntegrationTest.cs | 8 +- .../Microsoft.NET.Sdk.BlazorWebAssembly.props | 1 + ...icrosoft.NET.Sdk.BlazorWebAssembly.targets | 16 - ...ft.NET.Sdk.BlazorWebAssembly.Current.props | 7 +- ....NET.Sdk.BlazorWebAssembly.Current.targets | 2 +- .../blazorwasm-minimal.csproj | 6 +- .../testassets/blazorwasm/blazorwasm.csproj | 6 +- .../HostedInAspNet.Client.csproj | 4 +- .../StandaloneApp/StandaloneApp.csproj | 5 +- .../Wasm.Authentication.Client.csproj | 4 +- .../TestApp/Wasm.Performance.TestApp.csproj | 4 +- .../BasicTestApp/BasicTestApp.csproj | 4 +- .../BlazorTemplates.Tests.csproj | 2 +- .../BlazorWasmTemplateTest.cs | 3 - .../Infrastructure/Directory.Build.props.in | 2 + .../Infrastructure/TemplateTests.props.in | 1 + ...ponentsWebAssembly-CSharp.Client.csproj.in | 4 +- .../Infrastructure/TemplateTests.props.in | 1 + .../test/ProjectTemplates.Tests.csproj | 2 +- ...soft.NET.Sdk.Razor.IntegrationTests.csproj | 5 - .../src/AssetsManifestFile.cs | 33 -- .../src/BlazorReadSatelliteAssemblyFile.cs | 38 -- .../src/BlazorWriteSatelliteAssemblyFile.cs | 53 -- .../src/BootJsonData.cs | 85 --- .../src/BrotliCompress.cs | 99 ---- .../CreateBlazorTrimmerRootDescriptorFile.cs | 79 --- .../src/GZipCompress.cs | 70 --- .../src/GenerateBlazorWebAssemblyBootJson.cs | 155 ----- .../GenerateServiceWorkerAssetsManifest.cs | 97 --- ...onents.ServiceWorkerAssetsManifest.targets | 166 ------ ...soft.NET.Sdk.Razor.Components.Wasm.targets | 550 ------------------ .../Microsoft.NET.Sdk.Razor.ScopedCss.targets | 2 +- .../Sdk.Razor.CurrentVersion.targets | 2 - .../BlazorReadSatelliteAssemblyFileTest.cs | 68 --- .../test/GenerateBlazorBootJsonTest.cs | 195 ------- .../RestoreTestProjects.csproj | 3 - 38 files changed, 46 insertions(+), 1761 deletions(-) delete mode 100644 src/Components/WebAssembly/Sdk/src/build/net5.0/Microsoft.NET.Sdk.BlazorWebAssembly.targets delete mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/src/AssetsManifestFile.cs delete mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/src/BlazorReadSatelliteAssemblyFile.cs delete mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/src/BlazorWriteSatelliteAssemblyFile.cs delete mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/src/BootJsonData.cs delete mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/src/BrotliCompress.cs delete mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/src/CreateBlazorTrimmerRootDescriptorFile.cs delete mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/src/GZipCompress.cs delete mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/src/GenerateBlazorWebAssemblyBootJson.cs delete mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/src/GenerateServiceWorkerAssetsManifest.cs delete mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Components.ServiceWorkerAssetsManifest.targets delete mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Components.Wasm.targets delete mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/test/BlazorReadSatelliteAssemblyFileTest.cs delete mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/test/GenerateBlazorBootJsonTest.cs diff --git a/eng/targets/CSharp.Common.props b/eng/targets/CSharp.Common.props index b253b2c691..ff77d1b86a 100644 --- a/eng/targets/CSharp.Common.props +++ b/eng/targets/CSharp.Common.props @@ -12,7 +12,7 @@ - + + + + + + + + + + $(ArtifactsBinDir)\Microsoft.NET.Sdk.BlazorWebAssembly\$(Configuration)\sdk-output\ + + diff --git a/src/Components/Directory.Build.targets b/src/Components/Directory.Build.targets index f3143253af..4a150265af 100644 --- a/src/Components/Directory.Build.targets +++ b/src/Components/Directory.Build.targets @@ -1,5 +1,5 @@  - + $(RepoRoot)src\Components\Web.JS\dist\$(Configuration)\blazor.webassembly.js $(BlazorWebAssemblyJSPath).map @@ -12,7 +12,7 @@ + + false $(DefineConstants);REFERENCE_classlibrarywithsatelliteassemblies @@ -450,6 +452,8 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests wasmProject.AddProjectFileContent( @" + + false $(DefineConstants);REFERENCE_classlibrarywithsatelliteassemblies @@ -637,7 +641,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests // Arrange using var project = ProjectDirectory.Create("blazorhosted", additionalProjects: new[] { "blazorwasm", "razorclasslibrary", }); File.WriteAllText(Path.Combine(project.SolutionPath, "blazorwasm", "App.razor.css"), "h1 { font-size: 16px; }"); - + project.Configuration = "Release"; var result = await MSBuildProcessManager.DotnetMSBuild(project, "Build", "/p:BuildInsideVisualStudio=true"); @@ -701,6 +705,8 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests var existing = File.ReadAllText(blazorwasmProjFile); var updatedContent = @" + + false $(DefineConstants);REFERENCE_classlibrarywithsatelliteassemblies diff --git a/src/Components/WebAssembly/Sdk/src/build/net5.0/Microsoft.NET.Sdk.BlazorWebAssembly.props b/src/Components/WebAssembly/Sdk/src/build/net5.0/Microsoft.NET.Sdk.BlazorWebAssembly.props index 27e3fde3e0..05bfe13c09 100644 --- a/src/Components/WebAssembly/Sdk/src/build/net5.0/Microsoft.NET.Sdk.BlazorWebAssembly.props +++ b/src/Components/WebAssembly/Sdk/src/build/net5.0/Microsoft.NET.Sdk.BlazorWebAssembly.props @@ -12,5 +12,6 @@ Copyright (c) .NET Foundation. All rights reserved. <_BlazorWebAssemblyPropsFile>$(MSBuildThisFileDirectory)..\..\targets\Microsoft.NET.Sdk.BlazorWebAssembly.Current.props + <_BlazorWebAssemblyTargetsFile>$(MSBuildThisFileDirectory)..\..\targets\Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets diff --git a/src/Components/WebAssembly/Sdk/src/build/net5.0/Microsoft.NET.Sdk.BlazorWebAssembly.targets b/src/Components/WebAssembly/Sdk/src/build/net5.0/Microsoft.NET.Sdk.BlazorWebAssembly.targets deleted file mode 100644 index 8091b3d876..0000000000 --- a/src/Components/WebAssembly/Sdk/src/build/net5.0/Microsoft.NET.Sdk.BlazorWebAssembly.targets +++ /dev/null @@ -1,16 +0,0 @@ - - - - <_BlazorWebAssemblyTargetsFile>$(MSBuildThisFileDirectory)..\..\targets\Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets - - diff --git a/src/Components/WebAssembly/Sdk/src/targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.props b/src/Components/WebAssembly/Sdk/src/targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.props index 03b94ad566..a539c78f59 100644 --- a/src/Components/WebAssembly/Sdk/src/targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.props +++ b/src/Components/WebAssembly/Sdk/src/targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.props @@ -24,12 +24,7 @@ Copyright (c) .NET Foundation. All rights reserved. false - - - <_RazorSdkImportsMicrosoftNetSdkRazor Condition="'$(UsingMicrosoftNETSdkRazor)' != 'true'">true - - - + diff --git a/src/Components/WebAssembly/Sdk/src/targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets b/src/Components/WebAssembly/Sdk/src/targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets index eaf1888673..32b5b19913 100644 --- a/src/Components/WebAssembly/Sdk/src/targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets +++ b/src/Components/WebAssembly/Sdk/src/targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets @@ -15,7 +15,7 @@ Copyright (c) .NET Foundation. All rights reserved. true - + diff --git a/src/Components/WebAssembly/Sdk/testassets/blazorwasm-minimal/blazorwasm-minimal.csproj b/src/Components/WebAssembly/Sdk/testassets/blazorwasm-minimal/blazorwasm-minimal.csproj index bfebc5b020..2224de5260 100644 --- a/src/Components/WebAssembly/Sdk/testassets/blazorwasm-minimal/blazorwasm-minimal.csproj +++ b/src/Components/WebAssembly/Sdk/testassets/blazorwasm-minimal/blazorwasm-minimal.csproj @@ -1,6 +1,4 @@ - - - + net5.0 @@ -26,6 +24,4 @@ - - diff --git a/src/Components/WebAssembly/Sdk/testassets/blazorwasm/blazorwasm.csproj b/src/Components/WebAssembly/Sdk/testassets/blazorwasm/blazorwasm.csproj index c8906b1bd2..15abacbc0f 100644 --- a/src/Components/WebAssembly/Sdk/testassets/blazorwasm/blazorwasm.csproj +++ b/src/Components/WebAssembly/Sdk/testassets/blazorwasm/blazorwasm.csproj @@ -1,6 +1,4 @@ - - - + net5.0 @@ -52,6 +50,4 @@ - - diff --git a/src/Components/WebAssembly/testassets/HostedInAspNet.Client/HostedInAspNet.Client.csproj b/src/Components/WebAssembly/testassets/HostedInAspNet.Client/HostedInAspNet.Client.csproj index 0ff01b2ab1..c43a347a61 100644 --- a/src/Components/WebAssembly/testassets/HostedInAspNet.Client/HostedInAspNet.Client.csproj +++ b/src/Components/WebAssembly/testassets/HostedInAspNet.Client/HostedInAspNet.Client.csproj @@ -1,9 +1,7 @@ - + $(DefaultNetCoreTargetFramework) - browser-wasm - true diff --git a/src/Components/WebAssembly/testassets/StandaloneApp/StandaloneApp.csproj b/src/Components/WebAssembly/testassets/StandaloneApp/StandaloneApp.csproj index 77733924cd..82ae399fdb 100644 --- a/src/Components/WebAssembly/testassets/StandaloneApp/StandaloneApp.csproj +++ b/src/Components/WebAssembly/testassets/StandaloneApp/StandaloneApp.csproj @@ -1,10 +1,7 @@ - + $(DefaultNetCoreTargetFramework) - browser-wasm - true - true diff --git a/src/Components/WebAssembly/testassets/Wasm.Authentication.Client/Wasm.Authentication.Client.csproj b/src/Components/WebAssembly/testassets/Wasm.Authentication.Client/Wasm.Authentication.Client.csproj index 484aa06fce..974baf3b61 100644 --- a/src/Components/WebAssembly/testassets/Wasm.Authentication.Client/Wasm.Authentication.Client.csproj +++ b/src/Components/WebAssembly/testassets/Wasm.Authentication.Client/Wasm.Authentication.Client.csproj @@ -1,9 +1,7 @@ - + $(DefaultNetCoreTargetFramework) - browser-wasm - true diff --git a/src/Components/benchmarkapps/Wasm.Performance/TestApp/Wasm.Performance.TestApp.csproj b/src/Components/benchmarkapps/Wasm.Performance/TestApp/Wasm.Performance.TestApp.csproj index 84cd644558..d3e261a592 100644 --- a/src/Components/benchmarkapps/Wasm.Performance/TestApp/Wasm.Performance.TestApp.csproj +++ b/src/Components/benchmarkapps/Wasm.Performance/TestApp/Wasm.Performance.TestApp.csproj @@ -1,9 +1,7 @@ - + $(DefaultNetCoreTargetFramework) - browser-wasm - true true diff --git a/src/Components/test/testassets/BasicTestApp/BasicTestApp.csproj b/src/Components/test/testassets/BasicTestApp/BasicTestApp.csproj index bbcc855357..122d4bacff 100644 --- a/src/Components/test/testassets/BasicTestApp/BasicTestApp.csproj +++ b/src/Components/test/testassets/BasicTestApp/BasicTestApp.csproj @@ -1,9 +1,7 @@ - + $(DefaultNetCoreTargetFramework) - true - browser-wasm --pathbase /subdir diff --git a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj index 232a11f3a4..2da0e11666 100644 --- a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj +++ b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj @@ -141,7 +141,7 @@ diff --git a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs index c087fc3d07..a1922ddfe9 100644 --- a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs +++ b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs @@ -47,7 +47,6 @@ namespace Templates.Test Environment.SetEnvironmentVariable("EnableDefaultScopedCssItems", "true"); var project = await ProjectFactory.GetOrCreateProject("blazorstandalone", Output); - project.RuntimeIdentifier = "browser-wasm"; var createResult = await project.RunDotNetNewAsync("blazorwasm"); Assert.True(0 == createResult.ExitCode, ErrorMessages.GetFailedProcessMessage("create/restore", project, createResult)); @@ -145,7 +144,6 @@ namespace Templates.Test Environment.SetEnvironmentVariable("EnableDefaultScopedCssItems", "true"); var project = await ProjectFactory.GetOrCreateProject("blazorstandalonepwa", Output); - project.RuntimeIdentifier = "browser-wasm"; var createResult = await project.RunDotNetNewAsync("blazorwasm", args: new[] { "--pwa" }); Assert.True(0 == createResult.ExitCode, ErrorMessages.GetFailedProcessMessage("create/restore", project, createResult)); @@ -355,7 +353,6 @@ namespace Templates.Test Environment.SetEnvironmentVariable("EnableDefaultScopedCssItems", "true"); var project = await ProjectFactory.GetOrCreateProject("blazorstandaloneindividual", Output); - project.RuntimeIdentifier = "browser-wasm"; var createResult = await project.RunDotNetNewAsync("blazorwasm", args: new[] { "-au", diff --git a/src/ProjectTemplates/BlazorTemplates.Tests/Infrastructure/Directory.Build.props.in b/src/ProjectTemplates/BlazorTemplates.Tests/Infrastructure/Directory.Build.props.in index d4297df698..a035f9ed6c 100644 --- a/src/ProjectTemplates/BlazorTemplates.Tests/Infrastructure/Directory.Build.props.in +++ b/src/ProjectTemplates/BlazorTemplates.Tests/Infrastructure/Directory.Build.props.in @@ -3,4 +3,6 @@ net5.0 + + diff --git a/src/ProjectTemplates/BlazorTemplates.Tests/Infrastructure/TemplateTests.props.in b/src/ProjectTemplates/BlazorTemplates.Tests/Infrastructure/TemplateTests.props.in index 1ffcbf83d1..4da4a7ec23 100644 --- a/src/ProjectTemplates/BlazorTemplates.Tests/Infrastructure/TemplateTests.props.in +++ b/src/ProjectTemplates/BlazorTemplates.Tests/Infrastructure/TemplateTests.props.in @@ -36,6 +36,7 @@ --> ${ArtifactsBinDir}Microsoft.NET.Sdk.Razor\${Configuration}\sdk-output\ + ${ArtifactsBinDir}Microsoft.NET.Sdk.BlazorWebAssembly\${Configuration}\sdk-output\ diff --git a/src/ProjectTemplates/Web.ProjectTemplates/ComponentsWebAssembly-CSharp.Client.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/ComponentsWebAssembly-CSharp.Client.csproj.in index 24c38f6480..f7a592ba61 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/ComponentsWebAssembly-CSharp.Client.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/ComponentsWebAssembly-CSharp.Client.csproj.in @@ -1,9 +1,7 @@ - + ${DefaultNetCoreTargetFramework} - browser-wasm - true service-worker-assets.js diff --git a/src/ProjectTemplates/test/Infrastructure/TemplateTests.props.in b/src/ProjectTemplates/test/Infrastructure/TemplateTests.props.in index be883d274c..e5040c614b 100644 --- a/src/ProjectTemplates/test/Infrastructure/TemplateTests.props.in +++ b/src/ProjectTemplates/test/Infrastructure/TemplateTests.props.in @@ -37,4 +37,5 @@ ${ArtifactsBinDir}Microsoft.NET.Sdk.Razor\${Configuration}\sdk-output\ + diff --git a/src/ProjectTemplates/test/ProjectTemplates.Tests.csproj b/src/ProjectTemplates/test/ProjectTemplates.Tests.csproj index c20f7f0d59..d0142cdf6e 100644 --- a/src/ProjectTemplates/test/ProjectTemplates.Tests.csproj +++ b/src/ProjectTemplates/test/ProjectTemplates.Tests.csproj @@ -155,7 +155,7 @@ diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/integrationtests/Microsoft.NET.Sdk.Razor.IntegrationTests.csproj b/src/Razor/Microsoft.NET.Sdk.Razor/integrationtests/Microsoft.NET.Sdk.Razor.IntegrationTests.csproj index 7733267812..88e002ae81 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/integrationtests/Microsoft.NET.Sdk.Razor.IntegrationTests.csproj +++ b/src/Razor/Microsoft.NET.Sdk.Razor/integrationtests/Microsoft.NET.Sdk.Razor.IntegrationTests.csproj @@ -33,11 +33,6 @@ - - - - - diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/AssetsManifestFile.cs b/src/Razor/Microsoft.NET.Sdk.Razor/src/AssetsManifestFile.cs deleted file mode 100644 index 34dde41812..0000000000 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/AssetsManifestFile.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.AspNetCore.Razor.Tasks -{ -#pragma warning disable IDE1006 // Naming Styles - public class AssetsManifestFile - { - /// - /// Gets or sets a version string. - /// - public string version { get; set; } - - /// - /// Gets or sets the assets. Keys are URLs; values are base-64-formatted SHA256 content hashes. - /// - public AssetsManifestFileEntry[] assets { get; set; } - } - - public class AssetsManifestFileEntry - { - /// - /// Gets or sets the asset URL. Normally this will be relative to the application's base href. - /// - public string url { get; set; } - - /// - /// Gets or sets the file content hash. This should be the base-64-formatted SHA256 value. - /// - public string hash { get; set; } - } -#pragma warning restore IDE1006 // Naming Styles -} diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/BlazorReadSatelliteAssemblyFile.cs b/src/Razor/Microsoft.NET.Sdk.Razor/src/BlazorReadSatelliteAssemblyFile.cs deleted file mode 100644 index f2f95dbf26..0000000000 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/BlazorReadSatelliteAssemblyFile.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Linq; -using System.Xml.Linq; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace Microsoft.AspNetCore.Razor.Tasks -{ - public class BlazorReadSatelliteAssemblyFile : Task - { - [Output] - public ITaskItem[] SatelliteAssembly { get; set; } - - [Required] - public ITaskItem ReadFile { get; set; } - - public override bool Execute() - { - var document = XDocument.Load(ReadFile.ItemSpec); - SatelliteAssembly = document.Root - .Elements() - .Select(e => - { - // - - var taskItem = new TaskItem(e.Attribute("Name").Value); - taskItem.SetMetadata("Culture", e.Attribute("Culture").Value); - taskItem.SetMetadata("DestinationSubDirectory", e.Attribute("DestinationSubDirectory").Value); - - return taskItem; - }).ToArray(); - - return true; - } - } -} diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/BlazorWriteSatelliteAssemblyFile.cs b/src/Razor/Microsoft.NET.Sdk.Razor/src/BlazorWriteSatelliteAssemblyFile.cs deleted file mode 100644 index da07cf6d00..0000000000 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/BlazorWriteSatelliteAssemblyFile.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.IO; -using System.Xml; -using System.Xml.Linq; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace Microsoft.AspNetCore.Razor.Tasks -{ - public class BlazorWriteSatelliteAssemblyFile : Task - { - [Required] - public ITaskItem[] SatelliteAssembly { get; set; } - - [Required] - public ITaskItem WriteFile { get; set; } - - public override bool Execute() - { - using var fileStream = File.Create(WriteFile.ItemSpec); - WriteSatelliteAssemblyFile(fileStream); - return true; - } - - internal void WriteSatelliteAssemblyFile(Stream stream) - { - var root = new XElement("SatelliteAssembly"); - - foreach (var item in SatelliteAssembly) - { - // - - root.Add(new XElement("Assembly", - new XAttribute("Name", item.ItemSpec), - new XAttribute("Culture", item.GetMetadata("Culture")), - new XAttribute("DestinationSubDirectory", item.GetMetadata("DestinationSubDirectory")))); - } - - var xmlWriterSettings = new XmlWriterSettings - { - Indent = true, - OmitXmlDeclaration = true - }; - - using var writer = XmlWriter.Create(stream, xmlWriterSettings); - var xDocument = new XDocument(root); - - xDocument.Save(writer); - } - } -} diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/BootJsonData.cs b/src/Razor/Microsoft.NET.Sdk.Razor/src/BootJsonData.cs deleted file mode 100644 index af74b51a24..0000000000 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/BootJsonData.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Runtime.Serialization; -using ResourceHashesByNameDictionary = System.Collections.Generic.Dictionary; - -namespace Microsoft.AspNetCore.Razor.Tasks -{ -#pragma warning disable IDE1006 // Naming Styles - /// - /// Defines the structure of a Blazor boot JSON file - /// - public class BootJsonData - { - /// - /// Gets the name of the assembly with the application entry point - /// - public string entryAssembly { get; set; } - - /// - /// Gets the set of resources needed to boot the application. This includes the transitive - /// closure of .NET assemblies (including the entrypoint assembly), the dotnet.wasm file, - /// and any PDBs to be loaded. - /// - /// Within , dictionary keys are resource names, - /// and values are SHA-256 hashes formatted in prefixed base-64 style (e.g., 'sha256-abcdefg...') - /// as used for subresource integrity checking. - /// - public ResourcesData resources { get; set; } = new ResourcesData(); - - /// - /// Gets a value that determines whether to enable caching of the - /// inside a CacheStorage instance within the browser. - /// - public bool cacheBootResources { get; set; } - - /// - /// Gets a value that determines if this is a debug build. - /// - public bool debugBuild { get; set; } - - /// - /// Gets a value that determines if the linker is enabled. - /// - public bool linkerEnabled { get; set; } - - /// - /// Config files for the application - /// - public List config { get; set; } - } - - public class ResourcesData - { - /// - /// .NET Wasm runtime resources (dotnet.wasm, dotnet.js) etc. - /// - public ResourceHashesByNameDictionary runtime { get; set; } = new ResourceHashesByNameDictionary(); - - /// - /// "assembly" (.dll) resources - /// - public ResourceHashesByNameDictionary assembly { get; set; } = new ResourceHashesByNameDictionary(); - - /// - /// "debug" (.pdb) resources - /// - [DataMember(EmitDefaultValue = false)] - public ResourceHashesByNameDictionary pdb { get; set; } - - /// - /// localization (.satellite resx) resources - /// - [DataMember(EmitDefaultValue = false)] - public Dictionary satelliteResources { get; set; } - - /// - /// Assembly (.dll) resources that are loaded lazily during runtime - /// - [DataMember(EmitDefaultValue = false)] - public ResourceHashesByNameDictionary lazyAssembly { get; set; } - } -#pragma warning restore IDE1006 // Naming Styles -} diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/BrotliCompress.cs b/src/Razor/Microsoft.NET.Sdk.Razor/src/BrotliCompress.cs deleted file mode 100644 index 1ac1c343d7..0000000000 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/BrotliCompress.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; -using System.Linq; -using System.Security.Cryptography; -using System.Text; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace Microsoft.AspNetCore.Razor.Tasks -{ - public class BrotliCompress : DotNetToolTask - { - private static readonly char[] InvalidPathChars = Path.GetInvalidFileNameChars(); - - [Required] - public ITaskItem[] FilesToCompress { get; set; } - - [Output] - public ITaskItem[] CompressedFiles { get; set; } - - [Required] - public string OutputDirectory { get; set; } - - public string CompressionLevel { get; set; } - - public bool SkipIfOutputIsNewer { get; set; } - - internal override string Command => "brotli"; - - protected override string GenerateResponseFileCommands() - { - var builder = new StringBuilder(); - - builder.AppendLine(Command); - - if (!string.IsNullOrEmpty(CompressionLevel)) - { - builder.AppendLine("-c"); - builder.AppendLine(CompressionLevel); - } - - CompressedFiles = new ITaskItem[FilesToCompress.Length]; - - for (var i = 0; i < FilesToCompress.Length; i++) - { - var input = FilesToCompress[i]; - var inputFullPath = input.GetMetadata("FullPath"); - var relativePath = input.GetMetadata("RelativePath"); - var outputRelativePath = Path.Combine(OutputDirectory, CalculateTargetPath(relativePath, ".br")); - - var outputItem = new TaskItem(outputRelativePath); - input.CopyMetadataTo(outputItem); - // Relative path in the publish dir - outputItem.SetMetadata("RelativePath", relativePath + ".br"); - CompressedFiles[i] = outputItem; - - var outputFullPath = Path.GetFullPath(outputRelativePath); - - if (SkipIfOutputIsNewer && File.Exists(outputFullPath) && File.GetLastWriteTimeUtc(inputFullPath) < File.GetLastWriteTimeUtc(outputFullPath)) - { - Log.LogMessage(MessageImportance.Low, $"Skipping compression for '{input.ItemSpec}' because '{outputRelativePath}' is newer than '{input.ItemSpec}'."); - continue; - } - - builder.AppendLine("-s"); - builder.AppendLine(inputFullPath); - - builder.AppendLine("-o"); - builder.AppendLine(outputFullPath); - } - - return builder.ToString(); - } - - internal static string CalculateTargetPath(string relativePath, string extension) - { - // RelativePath can be long and if used as-is to write the output, might result in long path issues on Windows. - // Instead we'll calculate a fixed length path by hashing the input file name. This uses SHA1 similar to the Hash task in MSBuild - // since it has no crytographic significance. - using var hash = SHA1.Create(); - var bytes = Encoding.UTF8.GetBytes(relativePath); - var hashString = Convert.ToBase64String(hash.ComputeHash(bytes)); - - var builder = new StringBuilder(); - - for (var i = 0; i < 8; i++) - { - var c = hashString[i]; - builder.Append(InvalidPathChars.Contains(c) ? '+' : c); - } - - builder.Append(extension); - return builder.ToString(); - } - } -} diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/CreateBlazorTrimmerRootDescriptorFile.cs b/src/Razor/Microsoft.NET.Sdk.Razor/src/CreateBlazorTrimmerRootDescriptorFile.cs deleted file mode 100644 index 0f36be8a9d..0000000000 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/CreateBlazorTrimmerRootDescriptorFile.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Xml; -using System.Xml.Linq; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace Microsoft.AspNetCore.Razor.Tasks -{ - // Based on https://github.com/mono/linker/blob/3b329b9481e300bcf4fb88a2eebf8cb5ef8b323b/src/ILLink.Tasks/CreateRootDescriptorFile.cs - public class CreateBlazorTrimmerRootDescriptorFile : Task - { - [Required] - public ITaskItem[] Assemblies { get; set; } - - [Required] - public ITaskItem TrimmerFile { get; set; } - - public override bool Execute() - { - var rootDescriptor = CreateRootDescriptorContents(); - if (File.Exists(TrimmerFile.ItemSpec)) - { - var existing = File.ReadAllText(TrimmerFile.ItemSpec); - - if (string.Equals(rootDescriptor, existing, StringComparison.Ordinal)) - { - Log.LogMessage(MessageImportance.Low, "Skipping write to file {0} because contents would not change.", TrimmerFile.ItemSpec); - // Avoid writing if the file contents are identical. This is required for build incrementalism. - return !Log.HasLoggedErrors; - } - } - - File.WriteAllText(TrimmerFile.ItemSpec, rootDescriptor); - return !Log.HasLoggedErrors; - } - - internal string CreateRootDescriptorContents() - { - var roots = new XElement("linker"); - foreach (var assembly in Assemblies.OrderBy(a => a.ItemSpec)) - { - // NOTE: Descriptor files don't include the file extension - // in the assemblyName. - var assemblyName = assembly.GetMetadata("FileName"); - var typePreserved = assembly.GetMetadata("Preserve"); - var typeRequired = assembly.GetMetadata("Required"); - - var attributes = new List - { - new XAttribute("fullname", "*"), - new XAttribute("required", typeRequired), - }; - - if (!string.IsNullOrEmpty(typePreserved)) - { - attributes.Add(new XAttribute("preserve", typePreserved)); - } - - roots.Add(new XElement("assembly", - new XAttribute("fullname", assemblyName), - new XElement("type", attributes))); - } - - var xmlWriterSettings = new XmlWriterSettings - { - Indent = true, - OmitXmlDeclaration = true - }; - - return new XDocument(roots).Root.ToString(); - } - } -} diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/GZipCompress.cs b/src/Razor/Microsoft.NET.Sdk.Razor/src/GZipCompress.cs deleted file mode 100644 index 6649ee5d9c..0000000000 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/GZipCompress.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; -using System.IO.Compression; -using System.Linq; -using System.Security.Cryptography; -using System.Text; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace Microsoft.AspNetCore.Razor.Tasks -{ - public class GZipCompress : Task - { - [Required] - public ITaskItem[] FilesToCompress { get; set; } - - [Output] - public ITaskItem[] CompressedFiles { get; set; } - - [Required] - public string OutputDirectory { get; set; } - - public override bool Execute() - { - CompressedFiles = new ITaskItem[FilesToCompress.Length]; - - Directory.CreateDirectory(OutputDirectory); - - System.Threading.Tasks.Parallel.For(0, FilesToCompress.Length, i => - { - var file = FilesToCompress[i]; - var inputPath = file.ItemSpec; - var relativePath = file.GetMetadata("RelativePath"); - var outputRelativePath = Path.Combine( - OutputDirectory, - BrotliCompress.CalculateTargetPath(relativePath, ".gz")); - - var outputItem = new TaskItem(outputRelativePath); - outputItem.SetMetadata("RelativePath", relativePath + ".gz"); - CompressedFiles[i] = outputItem; - - if (File.Exists(outputRelativePath) && File.GetLastWriteTimeUtc(inputPath) < File.GetLastWriteTimeUtc(outputRelativePath)) - { - // Incrementalism. If input source doesn't exist or it exists and is not newer than the expected output, do nothing. - Log.LogMessage(MessageImportance.Low, $"Skipping '{inputPath}' because '{outputRelativePath}' is newer than '{inputPath}'."); - return; - } - - try - { - using var sourceStream = File.OpenRead(inputPath); - using var fileStream = File.Create(outputRelativePath); - using var stream = new GZipStream(fileStream, CompressionLevel.Optimal); - - sourceStream.CopyTo(stream); - } - catch (Exception e) - { - Log.LogErrorFromException(e); - return; - } - }); - - return !Log.HasLoggedErrors; - } - } -} diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/GenerateBlazorWebAssemblyBootJson.cs b/src/Razor/Microsoft.NET.Sdk.Razor/src/GenerateBlazorWebAssemblyBootJson.cs deleted file mode 100644 index 8d1939d06b..0000000000 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/GenerateBlazorWebAssemblyBootJson.cs +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.Serialization.Json; -using System.Text; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using ResourceHashesByNameDictionary = System.Collections.Generic.Dictionary; - -namespace Microsoft.AspNetCore.Razor.Tasks -{ - public class GenerateBlazorWebAssemblyBootJson : Task - { - [Required] - public string AssemblyPath { get; set; } - - [Required] - public ITaskItem[] Resources { get; set; } - - [Required] - public bool DebugBuild { get; set; } - - [Required] - public bool LinkerEnabled { get; set; } - - [Required] - public bool CacheBootResources { get; set; } - - public ITaskItem[] ConfigurationFiles { get; set; } - - [Required] - public string OutputPath { get; set; } - - public ITaskItem[] LazyLoadedAssemblies { get; set; } - - public override bool Execute() - { - using var fileStream = File.Create(OutputPath); - var entryAssemblyName = AssemblyName.GetAssemblyName(AssemblyPath).Name; - - try - { - WriteBootJson(fileStream, entryAssemblyName); - } - catch (Exception ex) - { - Log.LogErrorFromException(ex); - } - - return !Log.HasLoggedErrors; - } - - // Internal for tests - public void WriteBootJson(Stream output, string entryAssemblyName) - { - var result = new BootJsonData - { - entryAssembly = entryAssemblyName, - cacheBootResources = CacheBootResources, - debugBuild = DebugBuild, - linkerEnabled = LinkerEnabled, - resources = new ResourcesData(), - config = new List(), - }; - - // Build a two-level dictionary of the form: - // - assembly: - // - UriPath (e.g., "System.Text.Json.dll") - // - ContentHash (e.g., "4548fa2e9cf52986") - // - runtime: - // - UriPath (e.g., "dotnet.js") - // - ContentHash (e.g., "3448f339acf512448") - if (Resources != null) - { - var resourceData = result.resources; - foreach (var resource in Resources) - { - ResourceHashesByNameDictionary resourceList; - - var fileName = resource.GetMetadata("FileName"); - var extension = resource.GetMetadata("Extension"); - var resourceCulture = resource.GetMetadata("Culture"); - var assetType = resource.GetMetadata("AssetType"); - var resourceName = $"{fileName}{extension}"; - - if (IsLazyLoadedAssembly(fileName)) - { - resourceData.lazyAssembly ??= new ResourceHashesByNameDictionary(); - resourceList = resourceData.lazyAssembly; - } - else if (!string.IsNullOrEmpty(resourceCulture)) - { - resourceData.satelliteResources ??= new Dictionary(StringComparer.OrdinalIgnoreCase); - resourceName = resourceCulture + "/" + resourceName; - - if (!resourceData.satelliteResources.TryGetValue(resourceCulture, out resourceList)) - { - resourceList = new ResourceHashesByNameDictionary(); - resourceData.satelliteResources.Add(resourceCulture, resourceList); - } - } - else if (string.Equals(extension, ".pdb", StringComparison.OrdinalIgnoreCase)) - { - resourceData.pdb ??= new ResourceHashesByNameDictionary(); - resourceList = resourceData.pdb; - } - else if (string.Equals(extension, ".dll", StringComparison.OrdinalIgnoreCase)) - { - resourceList = resourceData.assembly; - } - else if (string.Equals(assetType, "native", StringComparison.OrdinalIgnoreCase)) - { - resourceList = resourceData.runtime; - } - else - { - // This should include items such as XML doc files, which do not need to be recorded in the manifest. - continue; - } - - if (!resourceList.ContainsKey(resourceName)) - { - resourceList.Add(resourceName, $"sha256-{resource.GetMetadata("FileHash")}"); - } - } - } - - if (ConfigurationFiles != null) - { - foreach (var configFile in ConfigurationFiles) - { - result.config.Add(Path.GetFileName(configFile.ItemSpec)); - } - } - - var serializer = new DataContractJsonSerializer(typeof(BootJsonData), new DataContractJsonSerializerSettings - { - UseSimpleDictionaryFormat = true - }); - - using var writer = JsonReaderWriterFactory.CreateJsonWriter(output, Encoding.UTF8, ownsStream: false, indent: true); - serializer.WriteObject(writer, result); - } - - private bool IsLazyLoadedAssembly(string fileName) - { - return LazyLoadedAssemblies != null && LazyLoadedAssemblies.Any(a => a.ItemSpec == fileName); - } - } -} diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/GenerateServiceWorkerAssetsManifest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/src/GenerateServiceWorkerAssetsManifest.cs deleted file mode 100644 index 8e5f0d39e7..0000000000 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/GenerateServiceWorkerAssetsManifest.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; -using System.Linq; -using System.Runtime.Serialization.Json; -using System.Security.Cryptography; -using System.Text; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace Microsoft.AspNetCore.Razor.Tasks -{ - public partial class GenerateServiceWorkerAssetsManifest : Task - { - [Required] - public ITaskItem[] Assets { get; set; } - - public string Version { get; set; } - - [Required] - public string OutputPath { get; set; } - - [Output] - public string CalculatedVersion { get; set; } - - public override bool Execute() - { - using var fileStream = File.Create(OutputPath); - CalculatedVersion = GenerateAssetManifest(fileStream); - - return true; - } - - internal string GenerateAssetManifest(Stream stream) - { - var assets = new AssetsManifestFileEntry[Assets.Length]; - System.Threading.Tasks.Parallel.For(0, assets.Length, i => - { - var item = Assets[i]; - var hash = item.GetMetadata("FileHash"); - var url = item.GetMetadata("AssetUrl"); - - if (string.IsNullOrEmpty(hash)) - { - // Some files that are part of the service worker manifest may not have their hashes previously - // calcualted. Calculate them at this time. - using var sha = SHA256.Create(); - using var file = File.OpenRead(item.ItemSpec); - var bytes = sha.ComputeHash(file); - - hash = Convert.ToBase64String(bytes); - } - - assets[i] = new AssetsManifestFileEntry - { - hash = "sha256-" + hash, - url = url, - }; - }); - - var version = Version; - if (string.IsNullOrEmpty(version)) - { - // If a version isn't specified (which is likely the most common case), construct a Version by combining - // the file names + hashes of all the inputs. - - var combinedHash = string.Join( - Environment.NewLine, - assets.OrderBy(f => f.url, StringComparer.Ordinal).Select(f => f.hash)); - - using var sha = SHA256.Create(); - var bytes = sha.ComputeHash(Encoding.UTF8.GetBytes(combinedHash)); - version = Convert.ToBase64String(bytes).Substring(0, 8); - } - - var data = new AssetsManifestFile - { - version = version, - assets = assets, - }; - - using var streamWriter = new StreamWriter(stream, Encoding.UTF8, bufferSize: 50, leaveOpen: true); - streamWriter.Write("self.assetsManifest = "); - streamWriter.Flush(); - - using var jsonWriter = JsonReaderWriterFactory.CreateJsonWriter(stream, Encoding.UTF8, ownsStream: false, indent: true); - new DataContractJsonSerializer(typeof(AssetsManifestFile)).WriteObject(jsonWriter, data); - jsonWriter.Flush(); - - streamWriter.WriteLine(";"); - - return version; - } - } -} diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Components.ServiceWorkerAssetsManifest.targets b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Components.ServiceWorkerAssetsManifest.targets deleted file mode 100644 index 0fec74e225..0000000000 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Components.ServiceWorkerAssetsManifest.targets +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - <_ServiceWorkerAssetsManifestIntermediateOutputPath>$(IntermediateOutputPath)$(ServiceWorkerAssetsManifest) - <_ServiceWorkerAssetsManifestFullPath>$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)/$(_ServiceWorkerAssetsManifestIntermediateOutputPath)')) - - - - <_ManifestStaticWebAsset Include="$(_ServiceWorkerAssetsManifestFullPath)"> - - $(PackageId) - $([MSBuild]::NormalizeDirectory('$(TargetDir)wwwroot\')) - $(StaticWebAssetBasePath) - $(ServiceWorkerAssetsManifest) - Never - - - - <_ServiceWorkerIntermediateFile Include="@(ServiceWorker->'$(IntermediateOutputPath)serviceworkers\%(Identity)')"> - %(ServiceWorker.PublishedContent) - %(ServiceWorker.Identity) - %(ServiceWorker.Identity) - %(ServiceWorker.Identity) - $([System.String]::Copy('%(ServiceWorker.Identity)').Substring(8)) - - - <_ServiceWorkerStaticWebAsset Include="%(_ServiceWorkerIntermediateFile.FullPath)"> - - $(PackageId) - $([MSBuild]::NormalizeDirectory('$(TargetDir)wwwroot\')) - $(StaticWebAssetBasePath) - %(TargetOutputPath) - Never - - - - - - - - - - - <_ServiceWorkItem Include="@(StaticWebAsset)" Exclude="$(_ServiceWorkerAssetsManifestFullPath);@(_ServiceWorkerStaticWebAsset)"> - $([System.String]::Copy('$([System.String]::Copy('%(StaticWebAsset.BasePath)').TrimEnd('/'))/%(StaticWebAsset.RelativePath)').Replace('\','/').TrimStart('/')) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ServiceWorkerAssetsManifestPublishIntermediateOutputPath>$(IntermediateOutputPath)publish-$(ServiceWorkerAssetsManifest) - - - - <_ServiceWorkerIntermediatePublishFile Include="$(IntermediateOutputPath)serviceworkers\%(FileName).publish%(Extension)"> - %(ServiceWorker.PublishedContent) - %(ServiceWorker.Identity) - %(ServiceWorker.Identity) - - - <_ServiceWorkerPublishFile Include="@(ResolvedFileToPublish)" Condition="$([System.String]::Copy('%(ResolvedFileToPublish.RelativePath)').Replace('\','/').StartsWith('wwwroot/'))"> - $([System.String]::Copy('%(ResolvedFileToPublish.RelativePath)').Replace('\','/').TrimStart('/')) - $([System.String]::Copy('%(RelativePath)').Replace('\','/').Substring(8)) - - - - - - - - - - - - - - - - - - - - diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Components.Wasm.targets b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Components.Wasm.targets deleted file mode 100644 index f748e635dc..0000000000 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Components.Wasm.targets +++ /dev/null @@ -1,550 +0,0 @@ - - - - - - - - - - - - true - true - - - true - link - false - - - false - true - false - false - false - - / - true - - - false - false - false - false - false - exe - - - <_BlazorOutputPath>wwwroot\_framework\ - <_BlazorSatelliteAssemblyCacheFile>$(IntermediateOutputPath)blazor.satelliteasm.props - - - $(OutputPath)$(PublishDirName)\ - - - - - - - - - - - - - <_DotNetJsVersion>$(BundledNETCoreAppPackageVersion) - <_DotNetJsVersion Condition="'$(RuntimeFrameworkVersion)' != ''">$(RuntimeFrameworkVersion) - <_BlazorDotnetJsFileName>dotnet.$(_DotNetJsVersion).js - <_BlazorDotNetJsFilePath>$(IntermediateOutputPath)$(_BlazorDotnetJsFileName) - - - - <_DotNetJsItem Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.DestinationSubPath)' == 'dotnet.js' AND '%(ReferenceCopyLocalPaths.AssetType)' == 'native'" /> - - - - - - - - - - - - - - - - <_BlazorJSFile Include="$(BlazorWebAssemblyJSPath)" /> - <_BlazorJSFile Include="$(BlazorWebAssemblyJSMapPath)" Condition="Exists('$(BlazorWebAssemblyJSMapPath)')" /> - - <_BlazorConfigFile Include="wwwroot\appsettings*.json" /> - - - - - - - <_BlazorCopyLocalPath - Include="@(ReferenceCopyLocalPaths)" - Exclude="@(ReferenceSatellitePaths)"/> - - <_BlazorCopyLocalPath Include="@(IntermediateSatelliteAssembliesWithTargetPath)"> - %(IntermediateSatelliteAssembliesWithTargetPath.Culture)\ - - - <_BlazorOutputWithTargetPath Include=" - @(_BlazorCopyLocalPath); - @(IntermediateAssembly); - @(_DebugSymbolsIntermediatePath); - @(_BlazorJSFile)" /> - - <_BlazorOutputWithTargetPath Include="@(ReferenceSatellitePaths)"> - $([System.String]::Copy('%(ReferenceSatellitePaths.DestinationSubDirectory)').Trim('\').Trim('/')) - - - - - - - - - - - <_BlazorOutputWithTargetPath - Include="@(_BlazorReadSatelliteAssembly)" - Exclude="@(_BlazorOutputWithTargetPath)" - Condition="'@(_BlazorReadSatelliteAssembly->Count())' != '0'" /> - - - <_BlazorOutputWithTargetPath - TargetPath="$(_BlazorOutputPath)%(_BlazorOutputWithTargetPath.DestinationSubDirectory)%(FileName)%(Extension)" - Condition="'%(__BlazorOutputWithTargetPath.TargetPath)' == ''" /> - - - - - - <_BlazorBuildGZipCompressDirectory>$(IntermediateOutputPath)build-gz\ - - - - - <_GzipFileToCompressForBuild - Include="@(ReferenceCopyLocalPaths)" - RelativePath="$(_BlazorOutputPath)%(ReferenceCopyLocalPaths.DestinationSubDirectory)%(FileName)%(Extension)" - Condition="'%(Extension)' == '.dll' or '%(ReferenceCopyLocalPaths.AssetType)' == 'native'" /> - - - - - - - - - - <_BlazorWriteSatelliteAssembly Include="@(_BlazorOutputWithTargetPath->HasMetadata('Culture'))" /> - - - - - - - - - - - - - - - - - - - - - - - - - - _BlazorWasmPrepareForRun; - $(PrepareForRunDependsOn) - - - - $(GetCurrentProjectStaticWebAssetsDependsOn); - _BlazorWasmPrepareForRun; - - - - - - <_BlazorBuildBootJsonPath>$(IntermediateOutputPath)blazor.boot.json - - - - - - - - - - <_BlazorWebAssemblyStaticWebAsset Include="$(_BlazorBuildBootJsonPath)"> - $(PackageId) - - $([MSBuild]::NormalizeDirectory('$(TargetDir)wwwroot\')) - $(StaticWebAssetBasePath) - _framework/blazor.boot.json - Never - - - <_BlazorWebAssemblyStaticWebAsset Include="@(_BlazorOutputWithHash)"> - $(PackageId) - - $([MSBuild]::NormalizeDirectory('$(TargetDir)wwwroot\')) - $(StaticWebAssetBasePath) - $([System.String]::Copy('%(_BlazorOutputWithHash.TargetPath)').Replace('\','/').Substring(8)) - Never - - - <_BlazorWebAssemblyStaticWebAsset Include="@(_BlazorBuildGZipCompressedFile)"> - $(PackageId) - - $([MSBuild]::NormalizeDirectory('$(TargetDir)wwwroot\')) - $(StaticWebAssetBasePath) - $([System.String]::Copy('%(_BlazorBuildGZipCompressedFile.RelativePath)').Replace('\','/').Substring(8)) - Never - - - - <_ExternalStaticWebAsset Include="@(_BlazorWebAssemblyStaticWebAsset)" SourceType="Generated" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_BlazorTypeGranularTrimmerDescriptorFile>$(IntermediateOutputPath)typegranularity.trimmerdescriptor.xml - - - - <_BlazorTypeGranularAssembly - Include="@(ManagedAssemblyToLink)" - Condition="'%(Extension)' == '.dll' AND ($([System.String]::Copy('%(Filename)').StartsWith('Microsoft.AspNetCore.')) or $([System.String]::Copy('%(Filename)').StartsWith('Microsoft.Extensions.')))"> - false - all - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_BlazorPublishBootResource - Include="@(ResolvedFileToPublish)" - Condition="$([System.String]::Copy('%(RelativePath)').Replace('\','/').StartsWith('wwwroot/_framework')) AND '%(Extension)' != '.a'" /> - - - - - - - - - - - - - - - - - - <_CompressedFileOutputPath>$(IntermediateOutputPath)compress\ - <_BlazorWebAssemblyBrotliIncremental>true - - - - <_FileToCompress - Include="@(ResolvedFileToPublish)" - Condition="$([System.String]::Copy('%(ResolvedFileToPublish.RelativePath)').Replace('\','/').StartsWith('wwwroot/'))" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_PublishingBlazorWasmProject>true - - - - - - - - - - - - - - %(RelativePath) - PreserveNewest - - - - - - - - - - - diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.ScopedCss.targets b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.ScopedCss.targets index 379958af80..e81ff9c2ee 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.ScopedCss.targets +++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.ScopedCss.targets @@ -58,7 +58,7 @@ Integration with static web assets: <_ScopedCssExtension>.rz.scp.css $(ResolveStaticWebAssetsInputsDependsOn);_CollectAllScopedCssAssets;AddScopedCssBundle $(ResolveCurrentProjectStaticWebAssetsInputsDependsOn);_AddGeneratedScopedCssFiles - $(GetCurrentProjectStaticWebAssetsDependsOn);IncludeScopedCssBundle; + $(GetCurrentProjectStaticWebAssetsDependsOn);IncludeScopedCssBundle; diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets index ed5f339bd0..277c0f0021 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets +++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets @@ -362,8 +362,6 @@ Copyright (c) .NET Foundation. All rights reserved. - -