From 70cdf11f76b0eeb4dcc235665e3502b236b9f444 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 11 Jan 2019 16:14:11 +0000 Subject: [PATCH] Make Razor Components apps not use Blazor build (#6562) * Replace UseServerSideBlazor with UseRazorComponents, which doesn't require Blazor build artifacts * Make UseRazorComponents serve blazor.server.js from embedded resource ... so we don't need a build step to put it on disk somewhere. * Fix TestServer * Update ComponentsApp not to use Blazor build targets * Update ComponentsApp.App sample to use new build package * Update string constant in test * Rename blazor.*.js to components.*.js * Ensure correct build order * Update nav menu title in Components sample app * Fix remaining paths * Switch ComponentsApp.App to use Sdk="Microsoft.NET.Sdk.Razor" * Update mono.cecil version * CR: Replace FrameworkFilesProvider with EmbeddedFileProvider * CR: Use ManifestEmbeddedFileProvider --- .../wwwroot/blazor-frame.html | 2 +- .../HostedInAspNet.Client/wwwroot/index.html | 2 +- .../samples/StandaloneApp/wwwroot/index.html | 2 +- .../Microsoft.AspNetCore.Blazor.Build.csproj | 6 +- .../Microsoft.AspNetCore.Blazor.Build.nuspec | 2 +- .../ReferenceFromSource.props | 2 +- .../targets/Blazor.MonoRuntime.props | 2 +- .../Microsoft.AspNetCore.Blazor.Server.csproj | 2 +- .../wwwroot/index.html | 2 +- .../wwwroot/index.html | 2 +- ...rosoft.AspNetCore.Blazor.Build.Test.csproj | 1 - src/Components/build/dependencies.props | 1 + .../samples/ComponentsApp.App/App.cshtml | 4 +- .../ComponentsApp.App.csproj | 25 ++--- .../samples/ComponentsApp.App/Program.cs | 14 --- .../ComponentsApp.App/Shared/NavMenu.cshtml | 4 +- .../samples/ComponentsApp.Server/Startup.cs | 11 +-- .../wwwroot/css/bootstrap/bootstrap.min.css | 0 .../css/bootstrap/bootstrap.min.css.map | 0 .../wwwroot/css/open-iconic/FONT-LICENSE | 0 .../wwwroot/css/open-iconic/ICON-LICENSE | 0 .../wwwroot/css/open-iconic/README.md | 0 .../font/css/open-iconic-bootstrap.min.css | 0 .../open-iconic/font/fonts/open-iconic.eot | Bin .../open-iconic/font/fonts/open-iconic.otf | Bin .../open-iconic/font/fonts/open-iconic.svg | 0 .../open-iconic/font/fonts/open-iconic.ttf | Bin .../open-iconic/font/fonts/open-iconic.woff | Bin .../wwwroot/css/site.css | 0 .../wwwroot/index.html | 4 +- ...ft.AspNetCore.Components.Browser.JS.csproj | 8 +- .../webpack.config.js | 4 +- .../BlazorApplicationBuilderExtensions.cs | 2 +- ...rComponentsApplicationBuilderExtensions.cs | 91 ++++++++++++++++++ .../Builder/RazorComponentsOptions.cs | 23 +++++ ...rSideBlazorApplicationBuilderExtensions.cs | 76 --------------- ...rComponentsServiceCollectionExtensions.cs} | 48 +++------ ...rosoft.AspNetCore.Components.Server.csproj | 9 +- .../ServerExecutionTests/ServerSideAppTest.cs | 2 +- .../testapps/BasicTestApp/wwwroot/index.html | 6 +- .../test/testapps/TestServer/Startup.cs | 2 +- 41 files changed, 185 insertions(+), 174 deletions(-) delete mode 100644 src/Components/samples/ComponentsApp.App/Program.cs rename src/Components/samples/{ComponentsApp.App => ComponentsApp.Server}/wwwroot/css/bootstrap/bootstrap.min.css (100%) rename src/Components/samples/{ComponentsApp.App => ComponentsApp.Server}/wwwroot/css/bootstrap/bootstrap.min.css.map (100%) rename src/Components/samples/{ComponentsApp.App => ComponentsApp.Server}/wwwroot/css/open-iconic/FONT-LICENSE (100%) rename src/Components/samples/{ComponentsApp.App => ComponentsApp.Server}/wwwroot/css/open-iconic/ICON-LICENSE (100%) rename src/Components/samples/{ComponentsApp.App => ComponentsApp.Server}/wwwroot/css/open-iconic/README.md (100%) rename src/Components/samples/{ComponentsApp.App => ComponentsApp.Server}/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css (100%) rename src/Components/samples/{ComponentsApp.App => ComponentsApp.Server}/wwwroot/css/open-iconic/font/fonts/open-iconic.eot (100%) rename src/Components/samples/{ComponentsApp.App => ComponentsApp.Server}/wwwroot/css/open-iconic/font/fonts/open-iconic.otf (100%) rename src/Components/samples/{ComponentsApp.App => ComponentsApp.Server}/wwwroot/css/open-iconic/font/fonts/open-iconic.svg (100%) rename src/Components/samples/{ComponentsApp.App => ComponentsApp.Server}/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf (100%) rename src/Components/samples/{ComponentsApp.App => ComponentsApp.Server}/wwwroot/css/open-iconic/font/fonts/open-iconic.woff (100%) rename src/Components/samples/{ComponentsApp.App => ComponentsApp.Server}/wwwroot/css/site.css (100%) rename src/Components/samples/{ComponentsApp.App => ComponentsApp.Server}/wwwroot/index.html (76%) create mode 100644 src/Components/src/Microsoft.AspNetCore.Components.Server/Builder/RazorComponentsApplicationBuilderExtensions.cs create mode 100644 src/Components/src/Microsoft.AspNetCore.Components.Server/Builder/RazorComponentsOptions.cs delete mode 100644 src/Components/src/Microsoft.AspNetCore.Components.Server/Builder/ServerSideBlazorApplicationBuilderExtensions.cs rename src/Components/src/Microsoft.AspNetCore.Components.Server/DependencyInjection/{ServerSideBlazorServiceCollectionExtensions.cs => RazorComponentsServiceCollectionExtensions.cs} (70%) diff --git a/src/Components/blazor/benchmarks/Microsoft.AspNetCore.Blazor.E2EPerformance/wwwroot/blazor-frame.html b/src/Components/blazor/benchmarks/Microsoft.AspNetCore.Blazor.E2EPerformance/wwwroot/blazor-frame.html index 59a2dc0063..e93b5f8d82 100644 --- a/src/Components/blazor/benchmarks/Microsoft.AspNetCore.Blazor.E2EPerformance/wwwroot/blazor-frame.html +++ b/src/Components/blazor/benchmarks/Microsoft.AspNetCore.Blazor.E2EPerformance/wwwroot/blazor-frame.html @@ -19,6 +19,6 @@ Loading... - + diff --git a/src/Components/blazor/samples/HostedInAspNet.Client/wwwroot/index.html b/src/Components/blazor/samples/HostedInAspNet.Client/wwwroot/index.html index a47b1ad84e..7defbfa816 100644 --- a/src/Components/blazor/samples/HostedInAspNet.Client/wwwroot/index.html +++ b/src/Components/blazor/samples/HostedInAspNet.Client/wwwroot/index.html @@ -7,6 +7,6 @@ Loading... - + diff --git a/src/Components/blazor/samples/StandaloneApp/wwwroot/index.html b/src/Components/blazor/samples/StandaloneApp/wwwroot/index.html index 5da6ba26b3..663e9776c1 100644 --- a/src/Components/blazor/samples/StandaloneApp/wwwroot/index.html +++ b/src/Components/blazor/samples/StandaloneApp/wwwroot/index.html @@ -11,6 +11,6 @@ Loading... - + diff --git a/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/Microsoft.AspNetCore.Blazor.Build.csproj b/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/Microsoft.AspNetCore.Blazor.Build.csproj index 7d01b1095d..c68831682f 100644 --- a/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/Microsoft.AspNetCore.Blazor.Build.csproj +++ b/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/Microsoft.AspNetCore.Blazor.Build.csproj @@ -43,8 +43,8 @@ - - + + @@ -72,7 +72,7 @@ - + diff --git a/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/Microsoft.AspNetCore.Blazor.Build.nuspec b/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/Microsoft.AspNetCore.Blazor.Build.nuspec index 84e70c3a59..7a8a465048 100644 --- a/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/Microsoft.AspNetCore.Blazor.Build.nuspec +++ b/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/Microsoft.AspNetCore.Blazor.Build.nuspec @@ -22,6 +22,6 @@ - + diff --git a/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/ReferenceFromSource.props b/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/ReferenceFromSource.props index 45c157f1fd..0d1f091e35 100644 --- a/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/ReferenceFromSource.props +++ b/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/ReferenceFromSource.props @@ -13,7 +13,7 @@ true - $(MSBuildThisFileDirectory)../../../src/Microsoft.AspNetCore.Components.Browser.JS/dist/blazor.*.js + $(MSBuildThisFileDirectory)../../../src/Microsoft.AspNetCore.Components.Browser.JS/dist/components.*.js diff --git a/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.props b/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.props index 20b8d90fcf..d15e156b1d 100644 --- a/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.props +++ b/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.props @@ -1,7 +1,7 @@ - $(MSBuildThisFileDirectory)../tools/blazor/blazor.*.js + $(MSBuildThisFileDirectory)../tools/blazor/components.*.js diff --git a/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Server/Microsoft.AspNetCore.Blazor.Server.csproj b/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Server/Microsoft.AspNetCore.Blazor.Server.csproj index f8c5cb8ae7..b69e5a6741 100644 --- a/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Server/Microsoft.AspNetCore.Blazor.Server.csproj +++ b/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Server/Microsoft.AspNetCore.Blazor.Server.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Client/wwwroot/index.html b/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Client/wwwroot/index.html index f7e0e86795..f58f6b62cb 100644 --- a/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Client/wwwroot/index.html +++ b/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Client/wwwroot/index.html @@ -11,6 +11,6 @@ Loading... - + diff --git a/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone-CSharp/wwwroot/index.html b/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone-CSharp/wwwroot/index.html index f0f4c327c3..88d5d43394 100644 --- a/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone-CSharp/wwwroot/index.html +++ b/src/Components/blazor/src/Microsoft.AspNetCore.Blazor.Templates/content/BlazorStandalone-CSharp/wwwroot/index.html @@ -11,6 +11,6 @@ Loading... - + diff --git a/src/Components/blazor/test/Microsoft.AspNetCore.Blazor.Build.Test/Microsoft.AspNetCore.Blazor.Build.Test.csproj b/src/Components/blazor/test/Microsoft.AspNetCore.Blazor.Build.Test/Microsoft.AspNetCore.Blazor.Build.Test.csproj index 733a46a277..8003e51a88 100644 --- a/src/Components/blazor/test/Microsoft.AspNetCore.Blazor.Build.Test/Microsoft.AspNetCore.Blazor.Build.Test.csproj +++ b/src/Components/blazor/test/Microsoft.AspNetCore.Blazor.Build.Test/Microsoft.AspNetCore.Blazor.Build.Test.csproj @@ -26,7 +26,6 @@ - diff --git a/src/Components/build/dependencies.props b/src/Components/build/dependencies.props index 352039e112..ac2a0ed17d 100644 --- a/src/Components/build/dependencies.props +++ b/src/Components/build/dependencies.props @@ -12,6 +12,7 @@ 3.0.0-alpha1-10605 3.0.0-alpha1-10605 3.0.0-alpha1-10605 + 0.10.1 3.0.0-alpha1-10605 0.8.0-preview1-20181122.3 2.1.2 diff --git a/src/Components/samples/ComponentsApp.App/App.cshtml b/src/Components/samples/ComponentsApp.App/App.cshtml index c89d889f5e..adfe72aa7d 100644 --- a/src/Components/samples/ComponentsApp.App/App.cshtml +++ b/src/Components/samples/ComponentsApp.App/App.cshtml @@ -1,5 +1,5 @@ - + diff --git a/src/Components/samples/ComponentsApp.App/ComponentsApp.App.csproj b/src/Components/samples/ComponentsApp.App/ComponentsApp.App.csproj index 9c1aa725fb..6e2b68355e 100644 --- a/src/Components/samples/ComponentsApp.App/ComponentsApp.App.csproj +++ b/src/Components/samples/ComponentsApp.App/ComponentsApp.App.csproj @@ -1,20 +1,21 @@ - + - - netstandard2.0 - Exe - + + netstandard2.0 + - - - - + + - - + + + + - \ No newline at end of file + + + diff --git a/src/Components/samples/ComponentsApp.App/Program.cs b/src/Components/samples/ComponentsApp.App/Program.cs deleted file mode 100644 index e045707788..0000000000 --- a/src/Components/samples/ComponentsApp.App/Program.cs +++ /dev/null @@ -1,14 +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 ComponentsApp.App -{ - public class Program - { - public static void Main(string[] args) - { - // TODO: Remove entry point - // Currently it's required because .Components.Build won't generate the boot JSON correctly without seeing an entrypoint - } - } -} diff --git a/src/Components/samples/ComponentsApp.App/Shared/NavMenu.cshtml b/src/Components/samples/ComponentsApp.App/Shared/NavMenu.cshtml index c2824be334..0f4a24e362 100644 --- a/src/Components/samples/ComponentsApp.App/Shared/NavMenu.cshtml +++ b/src/Components/samples/ComponentsApp.App/Shared/NavMenu.cshtml @@ -1,5 +1,5 @@ -