diff --git a/src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets b/src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets index 4e56da65ee98..09309d3800e9 100644 --- a/src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets +++ b/src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets @@ -91,7 +91,7 @@ Copyright (c) .NET Foundation. All rights reserved. $(ResolvePublishStaticWebAssetsDependsOn); ProcessPublishFilesForBlazor; - ComputeBlazorExtensionAssets; + ComputeBlazorExtensions; _AddPublishBlazorBootJsonToStaticWebAssets; @@ -465,10 +465,12 @@ Copyright (c) .NET Foundation. All rights reserved. (('%(StaticWebAsset.AssetTraitName)' == 'BlazorWebAssemblyResource' and '%(StaticWebAsset.AssetTraitValue)' != 'manifest' and '%(StaticWebAsset.AssetTraitValue)' != 'boot') or '%(StaticWebAsset.AssetTraitName)' == 'Culture')" /> - - + <_BlazorExtensionsCandidate Include="@(BlazorPublishExtension->'%(FullPath)')"> $(PackageId) diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmJsModulesIntegrationTests.cs b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmJsModulesIntegrationTests.cs index a95861037c4f..7bc9bc8fd6ea 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmJsModulesIntegrationTests.cs +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmJsModulesIntegrationTests.cs @@ -36,7 +36,7 @@ public void Build_DoesNotGenerateManifestJson_IncludesJSModulesOnBlazorBootJsonM var outputPath = build.GetOutputDirectory(DefaultTfm).ToString(); var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); - var path = Path.Combine(intermediateOutputPath, "StaticWebAssets.build.json"); + var path = Path.Combine(intermediateOutputPath, "staticwebassets.build.json"); new FileInfo(path).Should().Exist(); var manifest = StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(path)); AssertManifest(manifest, LoadBuildManifest()); @@ -68,7 +68,7 @@ public void JSModules_ManifestIncludesModuleTargetPaths() var outputPath = build.GetOutputDirectory(DefaultTfm).ToString(); var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); - var path = Path.Combine(intermediateOutputPath, "StaticWebAssets.build.json"); + var path = Path.Combine(intermediateOutputPath, "staticwebassets.build.json"); new FileInfo(path).Should().Exist(); var manifest = StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(path)); AssertManifest(manifest, LoadBuildManifest()); @@ -103,7 +103,7 @@ public void Publish_DoesNotGenerateManifestJson_IncludesJSModulesOnBlazorBootJso var outputPath = publish.GetOutputDirectory(DefaultTfm).ToString(); var intermediateOutputPath = publish.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); - var path = Path.Combine(intermediateOutputPath, "StaticWebAssets.publish.json"); + var path = Path.Combine(intermediateOutputPath, "staticwebassets.publish.json"); new FileInfo(path).Should().Exist(); var manifest = StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(path)); AssertManifest(manifest, LoadPublishManifest()); @@ -155,7 +155,7 @@ public void JsModules_CanHaveDifferentBuildAndPublishModules() var outputPath = publish.GetOutputDirectory(DefaultTfm).ToString(); var intermediateOutputPath = publish.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); - var path = Path.Combine(intermediateOutputPath, "StaticWebAssets.publish.json"); + var path = Path.Combine(intermediateOutputPath, "staticwebassets.publish.json"); new FileInfo(path).Should().Exist(); var manifest = StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(path)); AssertManifest(manifest, LoadPublishManifest()); @@ -199,20 +199,25 @@ public void JsModules_CanCustomizeBlazorInitialization() ProjectDirectory.WithProjectChanges(document => { - document.Root.Add(XElement.Parse(@" - + document.Root.Add( + XElement.Parse(@" + + $(ComputeBlazorExtensionsDependsOn);_CustomizeBlazorBootProcess +"), + XElement.Parse(@" + - - my-custom-extension - _bin/publish.extension.txt - - + + my-custom-extension + _bin/publish.extension.txt + + '%(FullPath)')"" - File=""$(IntermediateOutputPath)publish.extension.txt"" - WriteOnlyWhenDifferent=""true"" /> + Lines=""@(_BlazorBootFilesToUpdate->'%(FullPath)')"" + File=""$(IntermediateOutputPath)publish.extension.txt"" + WriteOnlyWhenDifferent=""true"" /> ")); }); @@ -224,7 +229,7 @@ public void JsModules_CanCustomizeBlazorInitialization() var outputPath = publish.GetOutputDirectory(DefaultTfm).ToString(); var intermediateOutputPath = publish.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); - var path = Path.Combine(intermediateOutputPath, "StaticWebAssets.publish.json"); + var path = Path.Combine(intermediateOutputPath, "staticwebassets.publish.json"); new FileInfo(path).Should().Exist(); var manifest = StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(path)); AssertManifest(manifest, LoadPublishManifest()); @@ -271,22 +276,27 @@ public void JsModules_Hosted_CanCustomizeBlazorInitialization() { if (Path.GetFileNameWithoutExtension(path) == "blazorwasm") { - document.Root.Add(XElement.Parse(@" - + document.Root.Add( + XElement.Parse(@" + + $(ComputeBlazorExtensionsDependsOn);_CustomizeBlazorBootProcess +"), + XElement.Parse(@" + - - my-custom-extension - _bin/publish.extension.txt - - + + my-custom-extension + _bin/publish.extension.txt + + '%(FullPath)')"" - File=""$(IntermediateOutputPath)publish.extension.txt"" - WriteOnlyWhenDifferent=""true"" /> + Lines=""@(_BlazorBootFilesToUpdate->'%(FullPath)')"" + File=""$(IntermediateOutputPath)publish.extension.txt"" + WriteOnlyWhenDifferent=""true"" /> ")); - } + } }); var publish = new PublishCommand(ProjectDirectory, "blazorhosted"); @@ -297,7 +307,7 @@ public void JsModules_Hosted_CanCustomizeBlazorInitialization() var outputPath = publish.GetOutputDirectory(DefaultTfm).ToString(); var intermediateOutputPath = publish.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); - var path = Path.Combine(intermediateOutputPath, "StaticWebAssets.publish.json"); + var path = Path.Combine(intermediateOutputPath, "staticwebassets.publish.json"); new FileInfo(path).Should().Exist(); var manifest = StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(path)); AssertManifest(manifest, LoadPublishManifest()); diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/JsModulesIntegrationTest.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/JsModulesIntegrationTest.cs index d04fd34be9c8..1f6f17fc39f5 100644 --- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/JsModulesIntegrationTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/JsModulesIntegrationTest.cs @@ -143,7 +143,7 @@ public void Publish_PublishesBundleToTheRightLocation() var outputPath = publish.GetOutputDirectory(DefaultTfm).ToString(); var intermediateOutputPath = publish.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); - var path = Path.Combine(intermediateOutputPath, "StaticWebAssets.publish.json"); + var path = Path.Combine(intermediateOutputPath, "staticwebassets.publish.json"); new FileInfo(path).Should().Exist(); var manifest = StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(path)); AssertManifest(manifest, LoadPublishManifest()); @@ -281,12 +281,12 @@ public void PublishProjectWithReferences_IncorporatesInitializersFromClassLibrar var intermediateOutputPath = publish.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = publish.GetOutputDirectory(DefaultTfm, "Debug").ToString(); - var path = Path.Combine(intermediateOutputPath, "StaticWebAssets.build.json"); + var path = Path.Combine(intermediateOutputPath, "staticwebassets.build.json"); AssertManifest( StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(path)), LoadBuildManifest()); - var finalPath = Path.Combine(intermediateOutputPath, "StaticWebAssets.publish.json"); + var finalPath = Path.Combine(intermediateOutputPath, "staticwebassets.publish.json"); AssertManifest( StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(finalPath)), LoadPublishManifest()); @@ -331,7 +331,7 @@ public void PublishProjectWithReferences_DifferentBuildAndPublish_LibraryInitial var intermediateOutputPath = publish.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = publish.GetOutputDirectory(DefaultTfm, "Debug").ToString(); - var path = Path.Combine(intermediateOutputPath, "StaticWebAssets.build.json"); ; + var path = Path.Combine(intermediateOutputPath, "staticwebassets.build.json"); ; var buildManifest = StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(path)); var initializers = buildManifest.Assets.Where(a => a.RelativePath == "AnotherClassLib.lib.module.js"); @@ -342,7 +342,7 @@ public void PublishProjectWithReferences_DifferentBuildAndPublish_LibraryInitial buildManifest, LoadBuildManifest()); - var finalPath = Path.Combine(intermediateOutputPath, "StaticWebAssets.publish.json"); + var finalPath = Path.Combine(intermediateOutputPath, "staticwebassets.publish.json"); AssertManifest( StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(finalPath)), LoadPublishManifest());