diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml
index 064ad0327b..0b502a034b 100644
--- a/.azure/pipelines/ci.yml
+++ b/.azure/pipelines/ci.yml
@@ -214,9 +214,9 @@ stages:
- bash: "./eng/scripts/install-nginx-mac.sh"
displayName: Installing Nginx
afterBuild:
- - bash: ./build.sh --ci --pack --no-build --no-restore --no-build-deps "/bl:artifacts/log/packages.pack.binlog"
+ - bash: ./build.sh --ci --pack --no-restore "/bl:artifacts/log/packages.pack.binlog"
displayName: Pack Packages (for Template tests)
- - bash: ./src/ProjectTemplates/build.sh --ci --pack --no-restore --no-build-deps "/bl:artifacts/log/template.pack.binlog"
+ - bash: ./src/ProjectTemplates/build.sh --ci --pack --no-restore "/bl:artifacts/log/template.pack.binlog"
displayName: Pack Templates (for Template tests)
- bash: ./build.sh --no-build --ci --test -p:RunFlakyTests=true
displayName: Run Flaky Tests
@@ -251,9 +251,9 @@ stages:
- bash: "echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p"
displayName: Increase inotify limit
afterBuild:
- - bash: ./build.sh --ci --pack --no-build --no-restore --no-build-deps "/bl:artifacts/log/packages.pack.binlog"
+ - bash: ./build.sh --ci --pack --no-restore "/bl:artifacts/log/packages.pack.binlog"
displayName: Pack Packages (for Template tests)
- - bash: ./src/ProjectTemplates/build.sh --ci --pack --no-restore --no-build-deps "/bl:artifacts/log/template.pack.binlog"
+ - bash: ./src/ProjectTemplates/build.sh --ci --pack --no-restore "/bl:artifacts/log/template.pack.binlog"
displayName: Pack Templates (for Template tests)
- bash: ./build.sh --no-build --ci --test -p:RunFlakyTests=true
displayName: Run Flaky Tests
diff --git a/src/Components/Blazor.sln b/src/Components/Blazor.sln
index cd32283c75..8790973228 100644
--- a/src/Components/Blazor.sln
+++ b/src/Components/Blazor.sln
@@ -89,15 +89,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Components.TestServer", "te
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebAssembly.Authentication", "WebAssembly.Authentication", "{C4D74173-702B-428A-B689-1A9AF51CE356}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Components.WebAssembly.Authentication", "Blazor\WebAssembly.Authentication\src\Microsoft.AspNetCore.Components.WebAssembly.Authentication.csproj", "{E5C5D4E9-2442-4C4C-94E7-1EDB8ADAD1FE}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Components.WebAssembly.Authentication", "WebAssembly\WebAssembly.Authentication\src\Microsoft.AspNetCore.Components.WebAssembly.Authentication.csproj", "{B3EF0C88-3466-40AE-9080-F694370F4192}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Components.WebAssembly.Authentication.Tests", "Blazor\WebAssembly.Authentication\test\Microsoft.AspNetCore.Components.WebAssembly.Authentication.Tests.csproj", "{E450CCAC-6E03-4306-9919-47AB0EE98657}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Components.WebAssembly.Authentication.Tests", "WebAssembly\WebAssembly.Authentication\test\Microsoft.AspNetCore.Components.WebAssembly.Authentication.Tests.csproj", "{2916EC17-1D1F-4949-9EC7-50725157F1A6}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wasm.Authentication.Server", "Blazor\testassets\Wasm.Authentication.Server\Wasm.Authentication.Server.csproj", "{B88282F3-1DEF-4B06-8AD6-5A9EF6BAFEEB}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wasm.Authentication.Client", "WebAssembly\testassets\Wasm.Authentication.Client\Wasm.Authentication.Client.csproj", "{7EFB9CAF-6716-43BF-A6EF-C2878E95F8A6}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wasm.Authentication.Client", "Blazor\testassets\Wasm.Authentication.Client\Wasm.Authentication.Client.csproj", "{7EF0A33A-3E96-4DF5-973C-257CFE6F79D8}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wasm.Authentication.Server", "WebAssembly\testassets\Wasm.Authentication.Server\Wasm.Authentication.Server.csproj", "{194EBC45-F98E-4919-B714-C1624EF17B31}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wasm.Authentication.Shared", "Blazor\testassets\Wasm.Authentication.Shared\Wasm.Authentication.Shared.csproj", "{A82A1C13-C452-423A-9287-A7E52F6A43E8}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wasm.Authentication.Shared", "WebAssembly\testassets\Wasm.Authentication.Shared\Wasm.Authentication.Shared.csproj", "{EAF50654-98ED-44BB-A120-0436EC0CD3E0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -445,66 +445,66 @@ Global
{EACC194A-8C1B-424D-B8FE-330E14CAF525}.Release|x64.Build.0 = Release|Any CPU
{EACC194A-8C1B-424D-B8FE-330E14CAF525}.Release|x86.ActiveCfg = Release|Any CPU
{EACC194A-8C1B-424D-B8FE-330E14CAF525}.Release|x86.Build.0 = Release|Any CPU
- {E5C5D4E9-2442-4C4C-94E7-1EDB8ADAD1FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E5C5D4E9-2442-4C4C-94E7-1EDB8ADAD1FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E5C5D4E9-2442-4C4C-94E7-1EDB8ADAD1FE}.Debug|x64.ActiveCfg = Debug|Any CPU
- {E5C5D4E9-2442-4C4C-94E7-1EDB8ADAD1FE}.Debug|x64.Build.0 = Debug|Any CPU
- {E5C5D4E9-2442-4C4C-94E7-1EDB8ADAD1FE}.Debug|x86.ActiveCfg = Debug|Any CPU
- {E5C5D4E9-2442-4C4C-94E7-1EDB8ADAD1FE}.Debug|x86.Build.0 = Debug|Any CPU
- {E5C5D4E9-2442-4C4C-94E7-1EDB8ADAD1FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E5C5D4E9-2442-4C4C-94E7-1EDB8ADAD1FE}.Release|Any CPU.Build.0 = Release|Any CPU
- {E5C5D4E9-2442-4C4C-94E7-1EDB8ADAD1FE}.Release|x64.ActiveCfg = Release|Any CPU
- {E5C5D4E9-2442-4C4C-94E7-1EDB8ADAD1FE}.Release|x64.Build.0 = Release|Any CPU
- {E5C5D4E9-2442-4C4C-94E7-1EDB8ADAD1FE}.Release|x86.ActiveCfg = Release|Any CPU
- {E5C5D4E9-2442-4C4C-94E7-1EDB8ADAD1FE}.Release|x86.Build.0 = Release|Any CPU
- {E450CCAC-6E03-4306-9919-47AB0EE98657}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E450CCAC-6E03-4306-9919-47AB0EE98657}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E450CCAC-6E03-4306-9919-47AB0EE98657}.Debug|x64.ActiveCfg = Debug|Any CPU
- {E450CCAC-6E03-4306-9919-47AB0EE98657}.Debug|x64.Build.0 = Debug|Any CPU
- {E450CCAC-6E03-4306-9919-47AB0EE98657}.Debug|x86.ActiveCfg = Debug|Any CPU
- {E450CCAC-6E03-4306-9919-47AB0EE98657}.Debug|x86.Build.0 = Debug|Any CPU
- {E450CCAC-6E03-4306-9919-47AB0EE98657}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E450CCAC-6E03-4306-9919-47AB0EE98657}.Release|Any CPU.Build.0 = Release|Any CPU
- {E450CCAC-6E03-4306-9919-47AB0EE98657}.Release|x64.ActiveCfg = Release|Any CPU
- {E450CCAC-6E03-4306-9919-47AB0EE98657}.Release|x64.Build.0 = Release|Any CPU
- {E450CCAC-6E03-4306-9919-47AB0EE98657}.Release|x86.ActiveCfg = Release|Any CPU
- {E450CCAC-6E03-4306-9919-47AB0EE98657}.Release|x86.Build.0 = Release|Any CPU
- {B88282F3-1DEF-4B06-8AD6-5A9EF6BAFEEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B88282F3-1DEF-4B06-8AD6-5A9EF6BAFEEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B88282F3-1DEF-4B06-8AD6-5A9EF6BAFEEB}.Debug|x64.ActiveCfg = Debug|Any CPU
- {B88282F3-1DEF-4B06-8AD6-5A9EF6BAFEEB}.Debug|x64.Build.0 = Debug|Any CPU
- {B88282F3-1DEF-4B06-8AD6-5A9EF6BAFEEB}.Debug|x86.ActiveCfg = Debug|Any CPU
- {B88282F3-1DEF-4B06-8AD6-5A9EF6BAFEEB}.Debug|x86.Build.0 = Debug|Any CPU
- {B88282F3-1DEF-4B06-8AD6-5A9EF6BAFEEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B88282F3-1DEF-4B06-8AD6-5A9EF6BAFEEB}.Release|Any CPU.Build.0 = Release|Any CPU
- {B88282F3-1DEF-4B06-8AD6-5A9EF6BAFEEB}.Release|x64.ActiveCfg = Release|Any CPU
- {B88282F3-1DEF-4B06-8AD6-5A9EF6BAFEEB}.Release|x64.Build.0 = Release|Any CPU
- {B88282F3-1DEF-4B06-8AD6-5A9EF6BAFEEB}.Release|x86.ActiveCfg = Release|Any CPU
- {B88282F3-1DEF-4B06-8AD6-5A9EF6BAFEEB}.Release|x86.Build.0 = Release|Any CPU
- {7EF0A33A-3E96-4DF5-973C-257CFE6F79D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7EF0A33A-3E96-4DF5-973C-257CFE6F79D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7EF0A33A-3E96-4DF5-973C-257CFE6F79D8}.Debug|x64.ActiveCfg = Debug|Any CPU
- {7EF0A33A-3E96-4DF5-973C-257CFE6F79D8}.Debug|x64.Build.0 = Debug|Any CPU
- {7EF0A33A-3E96-4DF5-973C-257CFE6F79D8}.Debug|x86.ActiveCfg = Debug|Any CPU
- {7EF0A33A-3E96-4DF5-973C-257CFE6F79D8}.Debug|x86.Build.0 = Debug|Any CPU
- {7EF0A33A-3E96-4DF5-973C-257CFE6F79D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7EF0A33A-3E96-4DF5-973C-257CFE6F79D8}.Release|Any CPU.Build.0 = Release|Any CPU
- {7EF0A33A-3E96-4DF5-973C-257CFE6F79D8}.Release|x64.ActiveCfg = Release|Any CPU
- {7EF0A33A-3E96-4DF5-973C-257CFE6F79D8}.Release|x64.Build.0 = Release|Any CPU
- {7EF0A33A-3E96-4DF5-973C-257CFE6F79D8}.Release|x86.ActiveCfg = Release|Any CPU
- {7EF0A33A-3E96-4DF5-973C-257CFE6F79D8}.Release|x86.Build.0 = Release|Any CPU
- {A82A1C13-C452-423A-9287-A7E52F6A43E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A82A1C13-C452-423A-9287-A7E52F6A43E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A82A1C13-C452-423A-9287-A7E52F6A43E8}.Debug|x64.ActiveCfg = Debug|Any CPU
- {A82A1C13-C452-423A-9287-A7E52F6A43E8}.Debug|x64.Build.0 = Debug|Any CPU
- {A82A1C13-C452-423A-9287-A7E52F6A43E8}.Debug|x86.ActiveCfg = Debug|Any CPU
- {A82A1C13-C452-423A-9287-A7E52F6A43E8}.Debug|x86.Build.0 = Debug|Any CPU
- {A82A1C13-C452-423A-9287-A7E52F6A43E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A82A1C13-C452-423A-9287-A7E52F6A43E8}.Release|Any CPU.Build.0 = Release|Any CPU
- {A82A1C13-C452-423A-9287-A7E52F6A43E8}.Release|x64.ActiveCfg = Release|Any CPU
- {A82A1C13-C452-423A-9287-A7E52F6A43E8}.Release|x64.Build.0 = Release|Any CPU
- {A82A1C13-C452-423A-9287-A7E52F6A43E8}.Release|x86.ActiveCfg = Release|Any CPU
- {A82A1C13-C452-423A-9287-A7E52F6A43E8}.Release|x86.Build.0 = Release|Any CPU
+ {B3EF0C88-3466-40AE-9080-F694370F4192}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B3EF0C88-3466-40AE-9080-F694370F4192}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B3EF0C88-3466-40AE-9080-F694370F4192}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {B3EF0C88-3466-40AE-9080-F694370F4192}.Debug|x64.Build.0 = Debug|Any CPU
+ {B3EF0C88-3466-40AE-9080-F694370F4192}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {B3EF0C88-3466-40AE-9080-F694370F4192}.Debug|x86.Build.0 = Debug|Any CPU
+ {B3EF0C88-3466-40AE-9080-F694370F4192}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B3EF0C88-3466-40AE-9080-F694370F4192}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B3EF0C88-3466-40AE-9080-F694370F4192}.Release|x64.ActiveCfg = Release|Any CPU
+ {B3EF0C88-3466-40AE-9080-F694370F4192}.Release|x64.Build.0 = Release|Any CPU
+ {B3EF0C88-3466-40AE-9080-F694370F4192}.Release|x86.ActiveCfg = Release|Any CPU
+ {B3EF0C88-3466-40AE-9080-F694370F4192}.Release|x86.Build.0 = Release|Any CPU
+ {2916EC17-1D1F-4949-9EC7-50725157F1A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2916EC17-1D1F-4949-9EC7-50725157F1A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2916EC17-1D1F-4949-9EC7-50725157F1A6}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {2916EC17-1D1F-4949-9EC7-50725157F1A6}.Debug|x64.Build.0 = Debug|Any CPU
+ {2916EC17-1D1F-4949-9EC7-50725157F1A6}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {2916EC17-1D1F-4949-9EC7-50725157F1A6}.Debug|x86.Build.0 = Debug|Any CPU
+ {2916EC17-1D1F-4949-9EC7-50725157F1A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2916EC17-1D1F-4949-9EC7-50725157F1A6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2916EC17-1D1F-4949-9EC7-50725157F1A6}.Release|x64.ActiveCfg = Release|Any CPU
+ {2916EC17-1D1F-4949-9EC7-50725157F1A6}.Release|x64.Build.0 = Release|Any CPU
+ {2916EC17-1D1F-4949-9EC7-50725157F1A6}.Release|x86.ActiveCfg = Release|Any CPU
+ {2916EC17-1D1F-4949-9EC7-50725157F1A6}.Release|x86.Build.0 = Release|Any CPU
+ {7EFB9CAF-6716-43BF-A6EF-C2878E95F8A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7EFB9CAF-6716-43BF-A6EF-C2878E95F8A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7EFB9CAF-6716-43BF-A6EF-C2878E95F8A6}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {7EFB9CAF-6716-43BF-A6EF-C2878E95F8A6}.Debug|x64.Build.0 = Debug|Any CPU
+ {7EFB9CAF-6716-43BF-A6EF-C2878E95F8A6}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {7EFB9CAF-6716-43BF-A6EF-C2878E95F8A6}.Debug|x86.Build.0 = Debug|Any CPU
+ {7EFB9CAF-6716-43BF-A6EF-C2878E95F8A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7EFB9CAF-6716-43BF-A6EF-C2878E95F8A6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7EFB9CAF-6716-43BF-A6EF-C2878E95F8A6}.Release|x64.ActiveCfg = Release|Any CPU
+ {7EFB9CAF-6716-43BF-A6EF-C2878E95F8A6}.Release|x64.Build.0 = Release|Any CPU
+ {7EFB9CAF-6716-43BF-A6EF-C2878E95F8A6}.Release|x86.ActiveCfg = Release|Any CPU
+ {7EFB9CAF-6716-43BF-A6EF-C2878E95F8A6}.Release|x86.Build.0 = Release|Any CPU
+ {194EBC45-F98E-4919-B714-C1624EF17B31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {194EBC45-F98E-4919-B714-C1624EF17B31}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {194EBC45-F98E-4919-B714-C1624EF17B31}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {194EBC45-F98E-4919-B714-C1624EF17B31}.Debug|x64.Build.0 = Debug|Any CPU
+ {194EBC45-F98E-4919-B714-C1624EF17B31}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {194EBC45-F98E-4919-B714-C1624EF17B31}.Debug|x86.Build.0 = Debug|Any CPU
+ {194EBC45-F98E-4919-B714-C1624EF17B31}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {194EBC45-F98E-4919-B714-C1624EF17B31}.Release|Any CPU.Build.0 = Release|Any CPU
+ {194EBC45-F98E-4919-B714-C1624EF17B31}.Release|x64.ActiveCfg = Release|Any CPU
+ {194EBC45-F98E-4919-B714-C1624EF17B31}.Release|x64.Build.0 = Release|Any CPU
+ {194EBC45-F98E-4919-B714-C1624EF17B31}.Release|x86.ActiveCfg = Release|Any CPU
+ {194EBC45-F98E-4919-B714-C1624EF17B31}.Release|x86.Build.0 = Release|Any CPU
+ {EAF50654-98ED-44BB-A120-0436EC0CD3E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EAF50654-98ED-44BB-A120-0436EC0CD3E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EAF50654-98ED-44BB-A120-0436EC0CD3E0}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {EAF50654-98ED-44BB-A120-0436EC0CD3E0}.Debug|x64.Build.0 = Debug|Any CPU
+ {EAF50654-98ED-44BB-A120-0436EC0CD3E0}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {EAF50654-98ED-44BB-A120-0436EC0CD3E0}.Debug|x86.Build.0 = Debug|Any CPU
+ {EAF50654-98ED-44BB-A120-0436EC0CD3E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EAF50654-98ED-44BB-A120-0436EC0CD3E0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EAF50654-98ED-44BB-A120-0436EC0CD3E0}.Release|x64.ActiveCfg = Release|Any CPU
+ {EAF50654-98ED-44BB-A120-0436EC0CD3E0}.Release|x64.Build.0 = Release|Any CPU
+ {EAF50654-98ED-44BB-A120-0436EC0CD3E0}.Release|x86.ActiveCfg = Release|Any CPU
+ {EAF50654-98ED-44BB-A120-0436EC0CD3E0}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -550,11 +550,11 @@ Global
{BC3DDF14-4961-49AB-8F19-2A23F535B0DE} = {10C06583-8506-42DE-863E-EAD48A1F7579}
{EACC194A-8C1B-424D-B8FE-330E14CAF525} = {10C06583-8506-42DE-863E-EAD48A1F7579}
{C4D74173-702B-428A-B689-1A9AF51CE356} = {B29FB58D-FAE5-405E-9695-BCF93582BE9A}
- {E5C5D4E9-2442-4C4C-94E7-1EDB8ADAD1FE} = {C4D74173-702B-428A-B689-1A9AF51CE356}
- {E450CCAC-6E03-4306-9919-47AB0EE98657} = {C4D74173-702B-428A-B689-1A9AF51CE356}
- {B88282F3-1DEF-4B06-8AD6-5A9EF6BAFEEB} = {CBD2BB24-3EC3-4950-ABE4-8C521D258DCD}
- {7EF0A33A-3E96-4DF5-973C-257CFE6F79D8} = {CBD2BB24-3EC3-4950-ABE4-8C521D258DCD}
- {A82A1C13-C452-423A-9287-A7E52F6A43E8} = {CBD2BB24-3EC3-4950-ABE4-8C521D258DCD}
+ {B3EF0C88-3466-40AE-9080-F694370F4192} = {C4D74173-702B-428A-B689-1A9AF51CE356}
+ {2916EC17-1D1F-4949-9EC7-50725157F1A6} = {C4D74173-702B-428A-B689-1A9AF51CE356}
+ {7EFB9CAF-6716-43BF-A6EF-C2878E95F8A6} = {B4ACD900-27B6-482B-B434-2C1E86E9D8BC}
+ {194EBC45-F98E-4919-B714-C1624EF17B31} = {B4ACD900-27B6-482B-B434-2C1E86E9D8BC}
+ {EAF50654-98ED-44BB-A120-0436EC0CD3E0} = {B4ACD900-27B6-482B-B434-2C1E86E9D8BC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {27A36094-AA50-4FFD-ADE6-C055E391F741}
diff --git a/src/Components/WebAssembly/Build/src/targets/All.props b/src/Components/WebAssembly/Build/src/targets/All.props
index d1d242f4d9..96c13335b6 100644
--- a/src/Components/WebAssembly/Build/src/targets/All.props
+++ b/src/Components/WebAssembly/Build/src/targets/All.props
@@ -1,8 +1,12 @@
+
+
- $(DefaultWebContentItemExcludes);wwwroot\**
+
+
+ /
true
diff --git a/src/Components/WebAssembly/Build/src/targets/All.targets b/src/Components/WebAssembly/Build/src/targets/All.targets
index 2b1a6c917a..c2954b6bf4 100644
--- a/src/Components/WebAssembly/Build/src/targets/All.targets
+++ b/src/Components/WebAssembly/Build/src/targets/All.targets
@@ -23,28 +23,4 @@
-
-
- $(AssemblyName).blazor.config
- $(TargetDir)$(BlazorMetadataFileName)
-
-
-
- <_BlazorConfigContent Include="$(MSBuildProjectFullPath)" />
- <_BlazorConfigContent Include="$(TargetPath)" />
- <_BlazorConfigContent Include="debug:true" Condition="'$(BlazorEnableDebugging)'=='true'" />
-
-
-
-
-
-
-
-
-
diff --git a/src/Components/WebAssembly/Build/src/targets/Blazor.MonoRuntime.targets b/src/Components/WebAssembly/Build/src/targets/Blazor.MonoRuntime.targets
index a2914519bb..9bb368d27d 100644
--- a/src/Components/WebAssembly/Build/src/targets/Blazor.MonoRuntime.targets
+++ b/src/Components/WebAssembly/Build/src/targets/Blazor.MonoRuntime.targets
@@ -19,36 +19,6 @@
$(DotNetWebAssemblyArtifactsRoot)\framework\
-
-
-
-
-
-
-
-
-
-
-
- <_BlazorStatisticsOutput Include="@(BlazorOutputWithTargetPath->'%(TargetOutputPath)')" />
-
-
-
-
-
@@ -131,7 +101,7 @@
true
$(BlazorRuntimeBinOutputPath)%(FileName)%(Extension)
%(FileName)%(Extension)
-
+
false
@@ -10,61 +10,7 @@
false
false
true
+
-
-
-
-
-
-
-
- $(BlazorPublishDistDir)$([System.String]::new(%(TargetPath)).Substring(8))
-
-
-
- <_BlazorGCTPDI Include="%(BlazorOutputWithTargetPath.Identity)">
- $(AssemblyName)\%(TargetOutputPath)
-
-
-
- %(TargetPath)
- PreserveNewest
-
-
-
-
-
- <_BlazorConfigPath>$(OutDir)$(AssemblyName).blazor.config
-
-
-
- <_BlazorPublishConfigContent Include="." />
- <_BlazorPublishConfigContent Include="$(AssemblyName)/" />
-
-
-
-
-
-
-
-
-
- <_StandaloneWebConfigContent Include="$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)Standalone.Web.config'))"/>
-
-
-
-
-
-
diff --git a/src/Components/WebAssembly/Build/src/targets/ServiceWorkerAssetsManifest.targets b/src/Components/WebAssembly/Build/src/targets/ServiceWorkerAssetsManifest.targets
index c92c8af17e..21151cc3e4 100644
--- a/src/Components/WebAssembly/Build/src/targets/ServiceWorkerAssetsManifest.targets
+++ b/src/Components/WebAssembly/Build/src/targets/ServiceWorkerAssetsManifest.targets
@@ -1,44 +1,17 @@
-
-
- <_BlazorCopyFilesToOutputDirectoryDependsOn>
- $(_BlazorCopyFilesToOutputDirectoryDependsOn);
- _ComputeServiceWorkerAssetsManifestInputs;
- _WriteServiceWorkerAssetsManifest;
-
-
+ BeforeTargets="_ResolveBlazorOutputs">
<_ServiceWorkerAssetsManifestIntermediateOutputPath>$(BlazorIntermediateOutputPath)serviceworkerassets.js
-
-
- $([System.String]::Copy('%(BlazorOutputWithTargetPath.TargetOutputPath)').Replace('\','/').Substring(5))
-
-
-
-
- $([System.String]::Copy('%(ContentWithTargetPath.TargetPath)').Replace('\','/').Substring(8))
-
-
-
-
- %(StaticWebAsset.BasePath)/%(StaticWebAsset.RelativePath)
-
+
@@ -48,6 +21,7 @@
-
-
+
+
+
+ $([System.String]::Copy('$([System.String]::Copy('%(StaticWebAsset.BasePath)').TrimEnd('/'))/%(StaticWebAsset.RelativePath)').Replace('\','/').TrimStart('/'))
+
+
+
@@ -94,5 +71,5 @@
$([System.String]::Copy('%(_ServiceWorkerAssetsManifestCombinedHash.FileHash)').Substring(0, 8))
-
+
diff --git a/src/Components/WebAssembly/Build/src/targets/Standalone.Web.config b/src/Components/WebAssembly/Build/src/targets/Standalone.Web.config
index 177a9b1404..ac7310e020 100644
--- a/src/Components/WebAssembly/Build/src/targets/Standalone.Web.config
+++ b/src/Components/WebAssembly/Build/src/targets/Standalone.Web.config
@@ -11,7 +11,7 @@
-
+
@@ -23,14 +23,14 @@
-
+
-
+
diff --git a/src/Components/WebAssembly/Build/src/targets/StaticWebAssets.props b/src/Components/WebAssembly/Build/src/targets/StaticWebAssets.props
new file mode 100644
index 0000000000..d15d07d729
--- /dev/null
+++ b/src/Components/WebAssembly/Build/src/targets/StaticWebAssets.props
@@ -0,0 +1,15 @@
+
+
+
+ $(ResolveStaticWebAssetsInputsDependsOn);
+ _BlazorApplyLinkPreferencesToStaticWebAssets;
+ _ResolveBlazorGeneratedAssets;
+
+
+
+ $(GetCurrentProjectStaticWebAssetsDependsOn);
+ _BlazorApplyLinkPreferencesToStaticWebAssets;
+ _ResolveBlazorGeneratedAssets;
+
+
+
diff --git a/src/Components/WebAssembly/Build/src/targets/StaticWebAssets.targets b/src/Components/WebAssembly/Build/src/targets/StaticWebAssets.targets
index d547f500b1..59bd345a6a 100644
--- a/src/Components/WebAssembly/Build/src/targets/StaticWebAssets.targets
+++ b/src/Components/WebAssembly/Build/src/targets/StaticWebAssets.targets
@@ -1,37 +1,161 @@
-
-
- $(ResolveStaticWebAssetsInputsDependsOn);
- _RemoveBlazorCurrentProjectAssetsFromStaticWebAssets;
-
-
-
- $(GetCurrentProjectStaticWebAssetsDependsOn);
- _RemoveBlazorCurrentProjectAssetsFromStaticWebAssets;
-
-
-
-
-
+
-
+
+
+ $(PackageId)
+ $([MSBuild]::NormalizeDirectory('$(TargetDir)wwwroot\'))
+ $(StaticWebAssetBasePath)
+ $([System.String]::Copy('%(BlazorOutputWithTargetPath.TargetOutputPath)').Replace('\','/').Replace('dist/',''))
+
+
+
+
+
+ <_ExternalStaticWebAsset Include="@(BlazorOutputWithTargetPath->'%(FullPath)')">
+ $(PackageId)
+
+ Generated
+ $([MSBuild]::NormalizeDirectory('$(TargetDir)wwwroot\'))
+ $(StaticWebAssetBasePath)
+
+
+
+
+ $(PackageId)
+ $(StaticWebAssetBasePath)
+
+
-
+
+
+ <_BlazorCurrentProjectWWWroot>$([MSBuild]::NormalizeDirectory('$(MSBuildProjectDirectory)\wwwroot\'))
+
+
+
+ <_BlazorCopyLocalAssets Include="@(StaticWebAsset)" Condition="'%(SourceType)' == '' and '%(ContentRoot)' != '$(_BlazorCurrentProjectWWWroot)'" />
+
+
+
+
+
+
+
+
+
+
+
+ <_BlazorStatisticsOutput Include="@(_BlazorCopyLocalAssets->'%(RelativePath)')" />
+
+
+
+
+
+
-
- <_StandaloneExternalPublishStaticWebAsset Include="@(_ExternalPublishStaticWebAsset)" Condition="'%(RelativePath)' != ''">
- $([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$([MSBuild]::NormalizePath('$([System.Text.RegularExpressions.Regex]::Replace('%(RelativePath)','^wwwroot\\?\/?(.*)','$(BlazorPublishDistDir)$1'))'))'))
-
-
-
-
+ <_CurrentProjectStandalonePublishStaticWebAsset Include="%(StaticWebAsset.FullPath)" Condition="'%(StaticWebAsset.SourceType)' == ''">
+ PreserveNewest
+ $([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)','$([MSBuild]::NormalizePath('wwwroot\%(BasePath)\%(RelativePath)'))'))
+
+
+
+
+
+
+ true
+
+
+
+ true
+ PreserveNewest
+ web.config
+
+
+
+
+
+ <_ContentWithWwrootLinkAttribute Include="@(Content)" Condition="'%(Content.Link)' != '' and $([System.String]::Copy('%(Content.Link)').Replace('\','/').StartsWith('wwwroot/'))" />
+
+ <_ContentLinkedIntoWwwroot
+ Include="@(_ContentWithWwrootLinkAttribute)"
+ Condition="@(_ContentWithWwrootLinkAttribute) != '' and '%(_ContentWithWwrootLinkAttribute.CopyToPublishDirectory)' != 'false'">
+
+ $([System.String]::Copy('%(Link)').Substring(8))
+
+
+ <_OutsideContentLinkedIntoWwwroot Include="@(_ContentLinkedIntoWwwroot->'%(FullPath)')" Condition="@(_ContentLinkedIntoWwwroot) != '' and !$([System.String]::Copy('%(Identity)').Replace('\','/').StartsWith('wwwroot/'))" />
+ <_WwwrootLinkedContent Include="@(_ContentLinkedIntoWwwroot->'%(FullPath)')" Condition="@(_ContentLinkedIntoWwwroot) != '' and $([System.String]::Copy('%(Identity)').Replace('\','/').StartsWith('wwwroot/'))" KeepMetadata="RelativePath" />
+
+
+ <_NonLinkedStaticWebAssets Include="@(StaticWebAsset)" Exclude="@(_WwwrootLinkedContent)" />
+ <_LinkedStaticWebAssets Include="@(StaticWebAsset)" Exclude="@(_NonLinkedStaticWebAssets)" />
+
+ <_UpdatedStaticWebAssets Include="%(Identity)">
+ @(_LinkedStaticWebAssets->'%(SourceType)')
+ @(_LinkedStaticWebAssets->'%(SourceId)')
+ @(_LinkedStaticWebAssets->'%(ContentRoot)')
+ @(_LinkedStaticWebAssets->'%(BasePath)')
+ @(_WwwrootLinkedContent->'%(RelativePath)')
+
+
+
+
+
+
+
+
+ $(PackageId)
+
+ $([MSBuild]::NormalizeDirectory('$(MSBuildProjectDirectory)\wwwroot\'))
+ $(StaticWebAssetBasePath)
+ %(_OutsideContentLinkedIntoWwwroot.RelativePath)
+
+
+ <_StaticWebAssetsPublishFalse Include="@(Content->'%(FullPath)')" Condition="'%(Content.CopyToPublishDirectory)' == 'false'" />
+ <_StaticWebAssetsLinkOutsideWwwroot Include="@(Content->'%(FullPath)')" Condition="'%(Content.Link)' != '' and !$([System.String]::Copy('%(Content.Link)').Replace('\','/').StartsWith('wwwroot/'))" />
+
+
+
+
+
+
+
+
diff --git a/src/Components/WebAssembly/Build/test/BuildIntegrationTests/BuildIntegrationTest.cs b/src/Components/WebAssembly/Build/test/BuildIntegrationTests/BuildIntegrationTest.cs
index fee3781b99..567b15928e 100644
--- a/src/Components/WebAssembly/Build/test/BuildIntegrationTests/BuildIntegrationTest.cs
+++ b/src/Components/WebAssembly/Build/test/BuildIntegrationTests/BuildIntegrationTest.cs
@@ -20,12 +20,15 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
var buildOutputDirectory = project.BuildOutputDirectory;
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "blazor.boot.json");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "blazor.webassembly.js");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "wasm", "dotnet.wasm");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "wasm", "dotnet.js");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "_bin", "standalone.dll");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "blazor.boot.json");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "blazor.webassembly.js");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "wasm", "dotnet.wasm");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "wasm", "dotnet.js");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "standalone.dll");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
+
+ var staticWebAssets = Assert.FileExists(result, buildOutputDirectory, "standalone.StaticWebAssets.xml");
+ Assert.FileContains(result, staticWebAssets, Path.Combine("netstandard2.1", "wwwroot"));
}
[Fact]
@@ -39,12 +42,14 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
Assert.BuildPassed(result);
var buildOutputDirectory = project.BuildOutputDirectory;
- var blazorConfig = Path.Combine(buildOutputDirectory, "standalone.blazor.config");
- Assert.FileExists(result, blazorConfig);
var path = Path.GetFullPath(Path.Combine(project.SolutionPath, "standalone", "bin", project.Configuration, "netstandard2.1", "standalone.dll"));
- Assert.FileContains(result, blazorConfig, path);
- Assert.FileDoesNotExist(result, buildOutputDirectory, "dist", "_framework", "_bin", "standalone.dll");
+ Assert.FileDoesNotExist(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "standalone.dll");
+
+ var staticWebAssets = Assert.FileExists(result, buildOutputDirectory, "blazorhosted.StaticWebAssets.xml");
+ Assert.FileContains(result, staticWebAssets, Path.Combine("netstandard2.1", "wwwroot"));
+ Assert.FileContains(result, staticWebAssets, Path.Combine("razorclasslibrary", "wwwroot"));
+ Assert.FileContains(result, staticWebAssets, Path.Combine("standalone", "wwwroot"));
}
[Fact]
@@ -63,12 +68,12 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
var buildOutputDirectory = project.BuildOutputDirectory;
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "blazor.boot.json");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "blazor.webassembly.js");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "wasm", "dotnet.wasm");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "wasm", "dotnet.js");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "_bin", "standalone.dll");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "blazor.boot.json");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "blazor.webassembly.js");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "wasm", "dotnet.wasm");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "wasm", "dotnet.js");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "standalone.dll");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
}
[Fact]
@@ -91,12 +96,12 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
var buildOutputDirectory = project.BuildOutputDirectory;
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "_bin", "standalone.dll");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "_bin", "classlibrarywithsatelliteassemblies.dll");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "_bin", "Microsoft.CodeAnalysis.CSharp.dll");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "_bin", "fr", "Microsoft.CodeAnalysis.CSharp.resources.dll"); // Verify satellite assemblies are present in the build output.
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "standalone.dll");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "classlibrarywithsatelliteassemblies.dll");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "Microsoft.CodeAnalysis.CSharp.dll");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "fr", "Microsoft.CodeAnalysis.CSharp.resources.dll"); // Verify satellite assemblies are present in the build output.
- var bootJsonPath = Path.Combine(buildOutputDirectory, "dist", "_framework", "blazor.boot.json");
+ var bootJsonPath = Path.Combine(buildOutputDirectory, "wwwroot", "_framework", "blazor.boot.json");
Assert.FileContains(result, bootJsonPath, "\"Microsoft.CodeAnalysis.CSharp.dll\"");
Assert.FileContains(result, bootJsonPath, "\"fr\\/Microsoft.CodeAnalysis.CSharp.resources.dll\"");
}
@@ -122,12 +127,12 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
var buildOutputDirectory = project.BuildOutputDirectory;
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "_bin", "standalone.dll");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "_bin", "classlibrarywithsatelliteassemblies.dll");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "_bin", "Microsoft.CodeAnalysis.CSharp.dll");
- Assert.FileExists(result, buildOutputDirectory, "dist", "_framework", "_bin", "fr", "Microsoft.CodeAnalysis.CSharp.resources.dll"); // Verify satellite assemblies are present in the build output.
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "standalone.dll");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "classlibrarywithsatelliteassemblies.dll");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "Microsoft.CodeAnalysis.CSharp.dll");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "fr", "Microsoft.CodeAnalysis.CSharp.resources.dll"); // Verify satellite assemblies are present in the build output.
- var bootJsonPath = Path.Combine(buildOutputDirectory, "dist", "_framework", "blazor.boot.json");
+ var bootJsonPath = Path.Combine(buildOutputDirectory, "wwwroot", "_framework", "blazor.boot.json");
Assert.FileContains(result, bootJsonPath, "\"Microsoft.CodeAnalysis.CSharp.dll\"");
Assert.FileContains(result, bootJsonPath, "\"fr\\/Microsoft.CodeAnalysis.CSharp.resources.dll\"");
}
diff --git a/src/Components/WebAssembly/Build/test/BuildIntegrationTests/PublishIntegrationTest.cs b/src/Components/WebAssembly/Build/test/BuildIntegrationTests/PublishIntegrationTest.cs
index a6cc006a5a..0a78a3d6e4 100644
--- a/src/Components/WebAssembly/Build/test/BuildIntegrationTests/PublishIntegrationTest.cs
+++ b/src/Components/WebAssembly/Build/test/BuildIntegrationTests/PublishIntegrationTest.cs
@@ -13,27 +13,33 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
public async Task Publish_WithDefaultSettings_Works()
{
// Arrange
- using var project = ProjectDirectory.Create("standalone", additionalProjects: new [] { "razorclasslibrary" });
+ using var project = ProjectDirectory.Create("standalone", additionalProjects: new [] { "razorclasslibrary", "LinkBaseToWebRoot" });
var result = await MSBuildProcessManager.DotnetMSBuild(project, "Publish");
Assert.BuildPassed(result);
var publishDirectory = project.PublishOutputDirectory;
- var blazorPublishDirectory = Path.Combine(publishDirectory, Path.GetFileNameWithoutExtension(project.ProjectFilePath));
+ var blazorPublishDirectory = Path.Combine(publishDirectory, "wwwroot");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "blazor.boot.json");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "blazor.webassembly.js");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "wasm", "dotnet.wasm");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "wasm", "dotnet.js");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "_bin", "standalone.dll");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.boot.json");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.webassembly.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.wasm");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "standalone.dll");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
// Verify referenced static web assets
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_content", "RazorClassLibrary", "wwwroot", "exampleJsInterop.js");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_content", "RazorClassLibrary", "styles.css");
+ Assert.FileExists(result, blazorPublishDirectory, "_content", "RazorClassLibrary", "wwwroot", "exampleJsInterop.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_content", "RazorClassLibrary", "styles.css");
// Verify static assets are in the publish directory
- Assert.FileExists(result, blazorPublishDirectory, "dist", "index.html");
+ Assert.FileExists(result, blazorPublishDirectory, "index.html");
+
+ // Verify link item assets are in the publish directory
+ Assert.FileExists(result, blazorPublishDirectory, "js", "LinkedScript.js");
+ var cssFile = Assert.FileExists(result, blazorPublishDirectory, "css", "site.css");
+ Assert.FileContains(result, cssFile, ".publish");
+ Assert.FileDoesNotExist(result, "dist", "Fake-License.txt");
// Verify web.config
Assert.FileExists(result, publishDirectory, "web.config");
@@ -53,25 +59,24 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
Assert.BuildPassed(result);
var publishDirectory = project.PublishOutputDirectory;
- var blazorPublishDirectory = Path.Combine(publishDirectory, Path.GetFileNameWithoutExtension(project.ProjectFilePath));
+ var blazorPublishDirectory = Path.Combine(publishDirectory, "wwwroot");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "blazor.boot.json");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "blazor.webassembly.js");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "wasm", "dotnet.wasm");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "wasm", "dotnet.js");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "_bin", "standalone.dll");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.boot.json");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.webassembly.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.wasm");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "standalone.dll");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
// Verify static assets are in the publish directory
- Assert.FileExists(result, blazorPublishDirectory, "dist", "index.html");
+ Assert.FileExists(result, blazorPublishDirectory, "index.html");
// Verify static web assets from referenced projects are copied.
- // Uncomment once https://github.com/aspnet/AspNetCore/issues/17426 is resolved.
- // Assert.FileExists(result, blazorPublishDirectory, "dist", "_content", "RazorClassLibrary", "wwwroot", "exampleJsInterop.js");
- // Assert.FileExists(result, blazorPublishDirectory, "dist", "_content", "RazorClassLibrary", "styles.css");
+ Assert.FileExists(result, blazorPublishDirectory, "_content", "RazorClassLibrary", "wwwroot", "exampleJsInterop.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_content", "RazorClassLibrary", "styles.css");
// Verify static assets are in the publish directory
- Assert.FileExists(result, blazorPublishDirectory, "dist", "index.html");
+ Assert.FileExists(result, blazorPublishDirectory, "index.html");
// Verify web.config
Assert.FileExists(result, publishDirectory, "web.config");
@@ -92,21 +97,21 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
Assert.BuildPassed(result);
var publishDirectory = project.PublishOutputDirectory;
- var blazorPublishDirectory = Path.Combine(publishDirectory, Path.GetFileNameWithoutExtension(project.ProjectFilePath));
+ var blazorPublishDirectory = Path.Combine(publishDirectory, "wwwroot");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "blazor.boot.json");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "blazor.webassembly.js");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "wasm", "dotnet.wasm");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "wasm", "dotnet.js");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "_bin", "standalone.dll");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.boot.json");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.webassembly.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.wasm");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "standalone.dll");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
// Verify static assets are in the publish directory
- Assert.FileExists(result, blazorPublishDirectory, "dist", "index.html");
+ Assert.FileExists(result, blazorPublishDirectory, "index.html");
// Verify referenced static web assets
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_content", "RazorClassLibrary", "wwwroot", "exampleJsInterop.js");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_content", "RazorClassLibrary", "styles.css");
+ Assert.FileExists(result, blazorPublishDirectory, "_content", "RazorClassLibrary", "wwwroot", "exampleJsInterop.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_content", "RazorClassLibrary", "styles.css");
// Verify web.config
Assert.FileExists(result, publishDirectory, "web.config");
@@ -131,12 +136,12 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
Assert.BuildPassed(result);
var publishDirectory = project.PublishOutputDirectory;
- var blazorPublishDirectory = Path.Combine(publishDirectory, Path.GetFileNameWithoutExtension(project.ProjectFilePath));
+ var blazorPublishDirectory = Path.Combine(publishDirectory, "wwwroot");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "_bin", "Microsoft.CodeAnalysis.CSharp.dll");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "_bin", "fr", "Microsoft.CodeAnalysis.CSharp.resources.dll"); // Verify satellite assemblies are present in the build output.
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "Microsoft.CodeAnalysis.CSharp.dll");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "fr", "Microsoft.CodeAnalysis.CSharp.resources.dll"); // Verify satellite assemblies are present in the build output.
- var bootJsonPath = Path.Combine(blazorPublishDirectory, "dist", "_framework", "blazor.boot.json");
+ var bootJsonPath = Path.Combine(blazorPublishDirectory, "_framework", "blazor.boot.json");
Assert.FileContains(result, bootJsonPath, "\"Microsoft.CodeAnalysis.CSharp.dll\"");
Assert.FileContains(result, bootJsonPath, "\"fr\\/Microsoft.CodeAnalysis.CSharp.resources.dll\"");
}
@@ -155,31 +160,23 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
// Make sure the main project exists
Assert.FileExists(result, publishDirectory, "blazorhosted.dll");
- var blazorPublishDirectory = Path.Combine(publishDirectory, "standalone");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "blazor.boot.json");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "blazor.webassembly.js");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "wasm", "dotnet.wasm");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "wasm", "dotnet.js");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "_bin", "standalone.dll");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
+ var blazorPublishDirectory = Path.Combine(publishDirectory, "wwwroot");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.boot.json");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.webassembly.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.wasm");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "standalone.dll");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
// Verify static assets are in the publish directory
- Assert.FileExists(result, blazorPublishDirectory, "dist", "index.html");
+ Assert.FileExists(result, blazorPublishDirectory, "index.html");
// Verify static web assets from referenced projects are copied.
Assert.FileExists(result, publishDirectory, "wwwroot", "_content", "RazorClassLibrary", "wwwroot", "exampleJsInterop.js");
Assert.FileExists(result, publishDirectory, "wwwroot", "_content", "RazorClassLibrary", "styles.css");
- // Verify static assets are in the publish directory
- Assert.FileExists(result, blazorPublishDirectory, "dist", "index.html");
-
// Verify web.config
Assert.FileExists(result, publishDirectory, "web.config");
-
- var blazorConfig = Path.Combine(result.Project.DirectoryPath, publishDirectory, "standalone.blazor.config");
- var blazorConfigLines = File.ReadAllLines(blazorConfig);
- Assert.Equal(".", blazorConfigLines[0]);
- Assert.Equal("standalone/", blazorConfigLines[1]);
}
[Fact]
@@ -207,32 +204,27 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
// Make sure the main project exists
Assert.FileExists(result, publishDirectory, "blazorhosted.dll");
- var blazorPublishDirectory = Path.Combine(publishDirectory, "standalone");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "blazor.boot.json");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "blazor.webassembly.js");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "wasm", "dotnet.wasm");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "wasm", "dotnet.js");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "_bin", "standalone.dll");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
+ var blazorPublishDirectory = Path.Combine(publishDirectory, "wwwroot");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.boot.json");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.webassembly.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.wasm");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "standalone.dll");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
// Verify static assets are in the publish directory
- Assert.FileExists(result, blazorPublishDirectory, "dist", "index.html");
+ Assert.FileExists(result, blazorPublishDirectory, "index.html");
// Verify static web assets from referenced projects are copied.
Assert.FileExists(result, publishDirectory, "wwwroot", "_content", "RazorClassLibrary", "wwwroot", "exampleJsInterop.js");
Assert.FileExists(result, publishDirectory, "wwwroot", "_content", "RazorClassLibrary", "styles.css");
// Verify static assets are in the publish directory
- Assert.FileExists(result, blazorPublishDirectory, "dist", "index.html");
+ Assert.FileExists(result, blazorPublishDirectory, "index.html");
// Verify web.config
Assert.FileExists(result, publishDirectory, "web.config");
- var blazorConfig = Path.Combine(result.Project.DirectoryPath, publishDirectory, "standalone.blazor.config");
- var blazorConfigLines = File.ReadAllLines(blazorConfig);
- Assert.Equal(".", blazorConfigLines[0]);
- Assert.Equal("standalone/", blazorConfigLines[1]);
-
void AddSiblingProjectFileContent(string content)
{
var path = Path.Combine(project.SolutionPath, "standalone", "standalone.csproj");
@@ -258,24 +250,21 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
// Make sure the main project exists
Assert.FileExists(result, publishDirectory, "blazorhosted.dll");
- var blazorPublishDirectory = Path.Combine(publishDirectory, "standalone");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "blazor.boot.json");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "blazor.webassembly.js");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "wasm", "dotnet.wasm");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "wasm", "dotnet.js");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "_bin", "standalone.dll");
- Assert.FileExists(result, blazorPublishDirectory, "dist", "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
+ var blazorPublishDirectory = Path.Combine(publishDirectory, "wwwroot");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.boot.json");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.webassembly.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.wasm");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.js");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "standalone.dll");
+ Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
// Verify static assets are in the publish directory
- Assert.FileExists(result, blazorPublishDirectory, "dist", "index.html");
+ Assert.FileExists(result, blazorPublishDirectory, "index.html");
// Verify static web assets from referenced projects are copied.
// Uncomment once https://github.com/aspnet/AspNetCore/issues/17426 is resolved.
- // Assert.FileExists(result, publishDirectory, "wwwroot", "_content", "RazorClassLibrary", "wwwroot", "exampleJsInterop.js");
- // Assert.FileExists(result, publishDirectory, "wwwroot", "_content", "RazorClassLibrary", "styles.css");
-
- // Verify static assets are in the publish directory
- Assert.FileExists(result, blazorPublishDirectory, "dist", "index.html");
+ Assert.FileExists(result, publishDirectory, "wwwroot", "_content", "RazorClassLibrary", "wwwroot", "exampleJsInterop.js");
+ Assert.FileExists(result, publishDirectory, "wwwroot", "_content", "RazorClassLibrary", "styles.css");
// Verify web.config
Assert.FileExists(result, publishDirectory, "web.config");
diff --git a/src/Components/WebAssembly/Build/testassets/LinkBaseToWebRoot/js/LinkedScript.js b/src/Components/WebAssembly/Build/testassets/LinkBaseToWebRoot/js/LinkedScript.js
new file mode 100644
index 0000000000..5f282702bb
--- /dev/null
+++ b/src/Components/WebAssembly/Build/testassets/LinkBaseToWebRoot/js/LinkedScript.js
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/Components/WebAssembly/Build/testassets/standalone/LinkToWebRoot/css/site.css b/src/Components/WebAssembly/Build/testassets/standalone/LinkToWebRoot/css/site.css
new file mode 100644
index 0000000000..6c9631b4e1
--- /dev/null
+++ b/src/Components/WebAssembly/Build/testassets/standalone/LinkToWebRoot/css/site.css
@@ -0,0 +1 @@
+.publish { }
diff --git a/src/Components/WebAssembly/Build/testassets/standalone/standalone.csproj b/src/Components/WebAssembly/Build/testassets/standalone/standalone.csproj
index 1b13eb3d53..dd3d8a2274 100644
--- a/src/Components/WebAssembly/Build/testassets/standalone/standalone.csproj
+++ b/src/Components/WebAssembly/Build/testassets/standalone/standalone.csproj
@@ -17,4 +17,21 @@
+
+
+
+ wwwroot\
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Components/WebAssembly/Build/testassets/standalone/wwwroot/Fake-License.txt b/src/Components/WebAssembly/Build/testassets/standalone/wwwroot/Fake-License.txt
new file mode 100644
index 0000000000..5f282702bb
--- /dev/null
+++ b/src/Components/WebAssembly/Build/testassets/standalone/wwwroot/Fake-License.txt
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/Components/WebAssembly/Build/testassets/standalone/wwwroot/css/site.css b/src/Components/WebAssembly/Build/testassets/standalone/wwwroot/css/site.css
new file mode 100644
index 0000000000..fc64a12376
--- /dev/null
+++ b/src/Components/WebAssembly/Build/testassets/standalone/wwwroot/css/site.css
@@ -0,0 +1 @@
+.build { }
diff --git a/src/Components/WebAssembly/DevServer/src/Server/Startup.cs b/src/Components/WebAssembly/DevServer/src/Server/Startup.cs
index 950db1b0a6..9096edfb0f 100644
--- a/src/Components/WebAssembly/DevServer/src/Server/Startup.cs
+++ b/src/Components/WebAssembly/DevServer/src/Server/Startup.cs
@@ -28,6 +28,8 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.DevServer.Server
{
services.AddRouting();
+ services.AddWebAssemblyStaticFilesConfiguration();
+
services.AddResponseCompression(options =>
{
options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[]
@@ -40,8 +42,6 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.DevServer.Server
public void Configure(IApplicationBuilder app, IWebHostEnvironment environment, IConfiguration configuration)
{
- var applicationAssemblyFullPath = ResolveApplicationAssemblyFullPath();
-
app.UseDeveloperExceptionPage();
app.UseResponseCompression();
EnableConfiguredPathbase(app, configuration);
@@ -49,34 +49,15 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.DevServer.Server
app.UseBlazorDebugging();
app.UseStaticFiles();
- app.UseClientSideBlazorFiles(applicationAssemblyFullPath);
app.UseRouting();
app.UseEndpoints(endpoints =>
{
- endpoints.MapFallbackToClientSideBlazor(applicationAssemblyFullPath, "index.html");
+ endpoints.MapFallbackToFile("index.html");
});
}
- private string ResolveApplicationAssemblyFullPath()
- {
- const string applicationPathKey = "applicationpath";
- var configuredApplicationPath = Configuration.GetValue(applicationPathKey);
- if (string.IsNullOrEmpty(configuredApplicationPath))
- {
- throw new InvalidOperationException($"No value was supplied for the required option '{applicationPathKey}'.");
- }
-
- var resolvedApplicationPath = Path.GetFullPath(configuredApplicationPath);
- if (!File.Exists(resolvedApplicationPath))
- {
- throw new InvalidOperationException($"Application assembly not found at {resolvedApplicationPath}.");
- }
-
- return resolvedApplicationPath;
- }
-
private static void EnableConfiguredPathbase(IApplicationBuilder app, IConfiguration configuration)
{
var pathBase = configuration.GetValue("pathbase");
diff --git a/src/Components/WebAssembly/Server/src/BlazorConfig.cs b/src/Components/WebAssembly/Server/src/BlazorConfig.cs
deleted file mode 100644
index 64254590bb..0000000000
--- a/src/Components/WebAssembly/Server/src/BlazorConfig.cs
+++ /dev/null
@@ -1,76 +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;
-
-namespace Microsoft.AspNetCore.Components.WebAssembly.Server
-{
- internal class BlazorConfig
- {
- public string SourceMSBuildPath { get; }
- public string SourceOutputAssemblyPath { get; }
- public string WebRootPath { get; }
- public string DistPath
- => Path.Combine(Path.GetDirectoryName(SourceOutputAssemblyPath), "dist");
- public bool EnableDebugging { get; }
-
- public static BlazorConfig Read(string assemblyPath)
- => new BlazorConfig(assemblyPath);
-
- private BlazorConfig(string assemblyPath)
- {
- // TODO: Instead of assuming the lines are in a specific order, either JSON-encode
- // the whole thing, or at least give the lines key prefixes (e.g., "reload:")
- // so we're not dependent on order and all lines being present.
-
- var configFilePath = Path.ChangeExtension(assemblyPath, ".blazor.config");
- var configLines = File.ReadLines(configFilePath).ToList();
- SourceMSBuildPath = configLines[0];
-
- if (SourceMSBuildPath == ".")
- {
- SourceMSBuildPath = assemblyPath;
- }
-
- var sourceMsBuildDir = Path.GetDirectoryName(SourceMSBuildPath);
- SourceOutputAssemblyPath = Path.Combine(sourceMsBuildDir, configLines[1]);
-
- var webRootPath = Path.Combine(sourceMsBuildDir, "wwwroot");
- if (Directory.Exists(webRootPath))
- {
- WebRootPath = webRootPath;
- }
-
- EnableDebugging = configLines.Contains("debug:true", StringComparer.Ordinal);
- }
-
- public string FindIndexHtmlFile()
- {
- // Before publishing, the client project may have a wwwroot directory.
- // If so, and if it contains index.html, use that.
- if (!string.IsNullOrEmpty(WebRootPath))
- {
- var wwwrootIndexHtmlPath = Path.Combine(WebRootPath, "index.html");
- if (File.Exists(wwwrootIndexHtmlPath))
- {
- return wwwrootIndexHtmlPath;
- }
- }
-
- // After publishing, the client project won't have a wwwroot directory.
- // The contents from that dir will have been copied to "dist" during publish.
- // So if "dist/index.html" now exists, use that.
- var distIndexHtmlPath = Path.Combine(DistPath, "index.html");
- if (File.Exists(distIndexHtmlPath))
- {
- return distIndexHtmlPath;
- }
-
- // Since there's no index.html, we'll use the default DefaultPageStaticFileOptions,
- // hence we'll look for index.html in the host server app's wwwroot.
- return null;
- }
- }
-}
diff --git a/src/Components/WebAssembly/Server/src/Builder/ComponentsWebAssemblyHostingApplicationBuilderExtensions.cs b/src/Components/WebAssembly/Server/src/Builder/ComponentsWebAssemblyHostingApplicationBuilderExtensions.cs
deleted file mode 100644
index ad2334dcd3..0000000000
--- a/src/Components/WebAssembly/Server/src/Builder/ComponentsWebAssemblyHostingApplicationBuilderExtensions.cs
+++ /dev/null
@@ -1,98 +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.Net.Mime;
-using Microsoft.AspNetCore.Components.WebAssembly.Server;
-using Microsoft.AspNetCore.StaticFiles;
-using Microsoft.Extensions.FileProviders;
-
-namespace Microsoft.AspNetCore.Builder
-{
- ///
- /// Provides extension methods for hosting Blazor WebAssembly applications in ASP.NET Core.
- ///
- public static class ComponentsWebAssemblyHostingApplicationBuilderExtensions
- {
- ///
- /// Adds a that will serve static files from the Blazor WebAssembly application
- /// specified by .
- ///
- /// A type in the Blazor WebAssembly application.
- /// The .
- /// The .
- public static IApplicationBuilder UseClientSideBlazorFiles(this IApplicationBuilder app)
- {
- if (app == null)
- {
- throw new ArgumentNullException(nameof(app));
- }
-
- UseClientSideBlazorFiles(app, typeof(TClientApp).Assembly.Location);
- return app;
- }
-
- ///
- /// Adds a that will serve static files from the Blazor WebAssembly application
- /// specified by .
- ///
- /// The file path of the Blazor WebAssembly application assembly.
- /// The .
- /// The .
- public static IApplicationBuilder UseClientSideBlazorFiles(this IApplicationBuilder app, string clientAssemblyFilePath)
- {
- if (clientAssemblyFilePath == null)
- {
- throw new ArgumentNullException(nameof(clientAssemblyFilePath));
- }
-
- var fileProviders = new List();
-
- // TODO: Make the .blazor.config file contents sane
- // Currently the items in it are bizarre and don't relate to their purpose,
- // hence all the path manipulation here. We shouldn't be hardcoding 'dist' here either.
- var config = BlazorConfig.Read(clientAssemblyFilePath);
-
- // First, match the request against files in the client app dist directory
- fileProviders.Add(new PhysicalFileProvider(config.DistPath));
-
- // * Before publishing, we serve the wwwroot files directly from source
- // (and don't require them to be copied into dist).
- // In this case, WebRootPath will be nonempty if that directory exists.
- // * After publishing, the wwwroot files are already copied to 'dist' and
- // will be served by the above middleware, so we do nothing here.
- // In this case, WebRootPath will be empty (the publish process sets this).
- if (!string.IsNullOrEmpty(config.WebRootPath))
- {
- fileProviders.Add(new PhysicalFileProvider(config.WebRootPath));
- }
-
- // We can't modify an IFileContentTypeProvider, so we have to decorate.
- var contentTypeProvider = new FileExtensionContentTypeProvider();
- AddMapping(contentTypeProvider, ".dll", MediaTypeNames.Application.Octet);
- if (config.EnableDebugging)
- {
- AddMapping(contentTypeProvider, ".pdb", MediaTypeNames.Application.Octet);
- }
-
- var options = new StaticFileOptions()
- {
- ContentTypeProvider = contentTypeProvider,
- FileProvider = new CompositeFileProvider(fileProviders),
- OnPrepareResponse = CacheHeaderSettings.SetCacheHeaders,
- };
-
- app.UseStaticFiles(options);
- return app;
-
- static void AddMapping(FileExtensionContentTypeProvider provider, string name, string mimeType)
- {
- if (!provider.Mappings.ContainsKey(name))
- {
- provider.Mappings.Add(name, mimeType);
- }
- }
- }
- }
-}
diff --git a/src/Components/WebAssembly/Server/src/Builder/ComponentsWebAssemblyHostingEndpointRouteBuilderExtensions.cs b/src/Components/WebAssembly/Server/src/Builder/ComponentsWebAssemblyHostingEndpointRouteBuilderExtensions.cs
deleted file mode 100644
index 33a8f5b374..0000000000
--- a/src/Components/WebAssembly/Server/src/Builder/ComponentsWebAssemblyHostingEndpointRouteBuilderExtensions.cs
+++ /dev/null
@@ -1,193 +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 Microsoft.AspNetCore.Components.WebAssembly.Server;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Routing;
-using Microsoft.AspNetCore.StaticFiles;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.FileProviders;
-
-namespace Microsoft.AspNetCore.Builder
-{
- ///
- /// Provides extension methods for hosting client-side Blazor applications in ASP.NET Core.
- ///
- public static class ComponentsWebAssemblyHostingEndpointRouteBuilderExtensions
- {
- ///
- /// Adds a low-priority endpoint that will serve the the file specified by from the client-side
- /// Blazor application specified by .
- ///
- /// A type in the client-side application.
- /// The .
- ///
- /// The relative path to the entry point of the client-side application. The path is relative to the
- /// , commonly wwwroot.
- ///
- /// The .
- ///
- ///
- /// This method is intended to handle cases where URL path of the request does not contain a filename, and no other
- /// endpoint has matched. This is convenient for routing requests for dynamic content to the client-side blazor
- /// application, while also allowing requests for non-existent files to result in an HTTP 404.
- ///
- ///
- public static IEndpointConventionBuilder MapFallbackToClientSideBlazor(this IEndpointRouteBuilder endpoints, string filePath)
- {
- if (endpoints == null)
- {
- throw new ArgumentNullException(nameof(endpoints));
- }
-
- if (filePath == null)
- {
- throw new ArgumentNullException(nameof(filePath));
- }
-
- return MapFallbackToClientSideBlazor(endpoints, typeof(TClientApp).Assembly.Location, FallbackEndpointRouteBuilderExtensions.DefaultPattern, filePath);
- }
-
- ///
- /// Adds a low-priority endpoint that will serve the the file specified by from the client-side
- /// Blazor application specified by .
- ///
- /// The .
- /// The file path of the client-side Blazor application assembly.
- ///
- /// The relative path to the entry point of the client-side application. The path is relative to the
- /// , commonly wwwroot.
- ///
- /// The .
- ///
- ///
- /// This method is intended to handle cases where URL path of the request does not contain a filename, and no other
- /// endpoint has matched. This is convenient for routing requests for dynamic content to the client-side blazor
- /// application, while also allowing requests for non-existent files to result in an HTTP 404.
- ///
- ///
- public static IEndpointConventionBuilder MapFallbackToClientSideBlazor(this IEndpointRouteBuilder endpoints, string clientAssemblyFilePath, string filePath)
- {
- if (endpoints == null)
- {
- throw new ArgumentNullException(nameof(endpoints));
- }
-
- if (clientAssemblyFilePath == null)
- {
- throw new ArgumentNullException(nameof(clientAssemblyFilePath));
- }
-
- if (filePath == null)
- {
- throw new ArgumentNullException(nameof(filePath));
- }
-
- return MapFallbackToClientSideBlazor(endpoints, clientAssemblyFilePath, FallbackEndpointRouteBuilderExtensions.DefaultPattern, filePath);
- }
-
- ///
- /// Adds a low-priority endpoint that will serve the the file specified by from the client-side
- /// Blazor application specified by .
- ///
- /// A type in the client-side application.
- /// The .
- /// The route pattern to match.
- ///
- /// The relative path to the entry point of the client-side application. The path is relative to the
- /// , commonly wwwroot.
- ///
- /// The .
- ///
- ///
- /// This method is intended to handle cases where URL path of the request does not contain a filename, and no other
- /// endpoint has matched. This is convenient for routing requests for dynamic content to the client-side blazor
- /// application, while also allowing requests for non-existent files to result in an HTTP 404.
- ///
- ///
- public static IEndpointConventionBuilder MapFallbackToClientSideBlazor(this IEndpointRouteBuilder endpoints, string pattern, string filePath)
- {
- if (endpoints == null)
- {
- throw new ArgumentNullException(nameof(endpoints));
- }
-
- if (pattern == null)
- {
- throw new ArgumentNullException(nameof(pattern));
- }
-
- if (filePath == null)
- {
- throw new ArgumentNullException(nameof(filePath));
- }
-
- return MapFallbackToClientSideBlazor(endpoints, typeof(TClientApp).Assembly.Location, pattern, filePath);
- }
-
- ///
- /// Adds a low-priority endpoint that will serve the the file specified by from the client-side
- /// Blazor application specified by .
- ///
- /// The file path of the client-side Blazor application assembly.
- /// The .
- /// The route pattern to match.
- ///
- /// The relative path to the entry point of the client-side application. The path is relative to the
- /// , commonly wwwroot.
- ///
- /// The .
- ///
- ///
- /// This method is intended to handle cases where URL path of the request does not contain a filename, and no other
- /// endpoint has matched. This is convenient for routing requests for dynamic content to the client-side blazor
- /// application, while also allowing requests for non-existent files to result in an HTTP 404.
- ///
- ///
- public static IEndpointConventionBuilder MapFallbackToClientSideBlazor(this IEndpointRouteBuilder endpoints, string clientAssemblyFilePath, string pattern, string filePath)
- {
- if (endpoints == null)
- {
- throw new ArgumentNullException(nameof(endpoints));
- }
-
- if (clientAssemblyFilePath == null)
- {
- throw new ArgumentNullException(nameof(clientAssemblyFilePath));
- }
-
- if (pattern == null)
- {
- throw new ArgumentNullException(nameof(pattern));
- }
-
- if (filePath == null)
- {
- throw new ArgumentNullException(nameof(filePath));
- }
-
- var config = BlazorConfig.Read(clientAssemblyFilePath);
-
- // We want to serve "index.html" from whichever directory contains it in this priority order:
- // 1. Client app "dist" directory
- // 2. Client app "wwwroot" directory
- // 3. Server app "wwwroot" directory
- var directory = endpoints.ServiceProvider.GetRequiredService().WebRootPath;
- var indexHtml = config.FindIndexHtmlFile();
- if (indexHtml != null)
- {
- directory = Path.GetDirectoryName(indexHtml);
- }
-
- var options = new StaticFileOptions()
- {
- FileProvider = new PhysicalFileProvider(directory),
- OnPrepareResponse = CacheHeaderSettings.SetCacheHeaders,
- };
-
- return endpoints.MapFallbackToFile(pattern, filePath, options);
- }
- }
-}
diff --git a/src/Components/WebAssembly/Server/src/Services/ComponentsWebAssemblyServiceCollectionExtensions.cs b/src/Components/WebAssembly/Server/src/Services/ComponentsWebAssemblyServiceCollectionExtensions.cs
new file mode 100644
index 0000000000..07c95c063f
--- /dev/null
+++ b/src/Components/WebAssembly/Server/src/Services/ComponentsWebAssemblyServiceCollectionExtensions.cs
@@ -0,0 +1,51 @@
+// 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.Net.Mime;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.StaticFiles;
+using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.Extensions.Options;
+
+namespace Microsoft.Extensions.DependencyInjection
+{
+ public static class ComponentsWebAssemblyServiceCollectionExtensions
+ {
+ public static IServiceCollection AddWebAssemblyStaticFilesConfiguration(this IServiceCollection services)
+ {
+ services.TryAddEnumerable(ServiceDescriptor.Singleton, ClientSideBlazorStaticFilesConfiguration>());
+ return services;
+ }
+
+ private class ClientSideBlazorStaticFilesConfiguration : IConfigureOptions
+ {
+ private readonly IWebHostEnvironment _webHostEnvironment;
+
+ public ClientSideBlazorStaticFilesConfiguration(IWebHostEnvironment webHostEnvironment)
+ {
+ _webHostEnvironment = webHostEnvironment;
+ }
+
+ public void Configure(StaticFileOptions options)
+ {
+ options.FileProvider = _webHostEnvironment.WebRootFileProvider;
+ var contentTypeProvider = new FileExtensionContentTypeProvider();
+ AddMapping(contentTypeProvider, ".dll", MediaTypeNames.Application.Octet);
+ // We unconditionally map pdbs as there will be no pdbs in the output folder for
+ // release builds unless BlazorEnableDebugging is explicitly set to true.
+ AddMapping(contentTypeProvider, ".pdb", MediaTypeNames.Application.Octet);
+
+ options.ContentTypeProvider = contentTypeProvider;
+ }
+
+ private static void AddMapping(FileExtensionContentTypeProvider provider, string name, string mimeType)
+ {
+ if (!provider.Mappings.ContainsKey(name))
+ {
+ provider.Mappings.Add(name, mimeType);
+ }
+ }
+ }
+ }
+}
diff --git a/src/Components/WebAssembly/testassets/HostedInAspNet.Server/Program.cs b/src/Components/WebAssembly/testassets/HostedInAspNet.Server/Program.cs
index 412cdfac8b..bcb0fcf29b 100644
--- a/src/Components/WebAssembly/testassets/HostedInAspNet.Server/Program.cs
+++ b/src/Components/WebAssembly/testassets/HostedInAspNet.Server/Program.cs
@@ -17,6 +17,10 @@ namespace HostedInAspNet.Server
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webHostBuilder =>
{
+ // We require this line because we run in Production environment
+ // and static web assets are only on by default during development.
+ webHostBuilder.UseStaticWebAssets();
+
webHostBuilder.UseStartup();
})
.Build();
diff --git a/src/Components/WebAssembly/testassets/HostedInAspNet.Server/Startup.cs b/src/Components/WebAssembly/testassets/HostedInAspNet.Server/Startup.cs
index ad10a0e190..40bdd6c37c 100644
--- a/src/Components/WebAssembly/testassets/HostedInAspNet.Server/Startup.cs
+++ b/src/Components/WebAssembly/testassets/HostedInAspNet.Server/Startup.cs
@@ -15,6 +15,7 @@ namespace HostedInAspNet.Server
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton();
+ services.AddWebAssemblyStaticFilesConfiguration();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -34,13 +35,12 @@ namespace HostedInAspNet.Server
}
app.UseStaticFiles();
- app.UseClientSideBlazorFiles();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
- endpoints.MapFallbackToClientSideBlazor("index.html");
+ endpoints.MapFallbackToFile("index.html");
});
}
}
diff --git a/src/Components/WebAssembly/testassets/MonoSanity/Program.cs b/src/Components/WebAssembly/testassets/MonoSanity/Program.cs
index d6fc0b8f48..6481e4d4bc 100644
--- a/src/Components/WebAssembly/testassets/MonoSanity/Program.cs
+++ b/src/Components/WebAssembly/testassets/MonoSanity/Program.cs
@@ -17,6 +17,9 @@ namespace MonoSanity
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webHostBuilder =>
{
+ // We require this line because we run in Production environment
+ // and static web assets are only on by default during development.
+ webHostBuilder.UseStaticWebAssets();
webHostBuilder.UseStartup();
})
.Build();
diff --git a/src/Components/WebAssembly/testassets/MonoSanity/Startup.cs b/src/Components/WebAssembly/testassets/MonoSanity/Startup.cs
index 84614a890a..17f115a565 100644
--- a/src/Components/WebAssembly/testassets/MonoSanity/Startup.cs
+++ b/src/Components/WebAssembly/testassets/MonoSanity/Startup.cs
@@ -10,6 +10,7 @@ namespace MonoSanity
{
public void ConfigureServices(IServiceCollection services)
{
+ services.AddWebAssemblyStaticFilesConfiguration();
}
public void Configure(IApplicationBuilder app)
@@ -17,11 +18,10 @@ namespace MonoSanity
app.UseDeveloperExceptionPage();
app.UseFileServer(new FileServerOptions() { EnableDefaultFiles = true, });
app.UseStaticFiles();
- app.UseClientSideBlazorFiles();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
- endpoints.MapFallbackToClientSideBlazor("index.html");
+ endpoints.MapFallbackToFile("index.html");
});
}
}
diff --git a/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Startup.cs b/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Startup.cs
index 8c174b900d..2e239f07a0 100644
--- a/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Startup.cs
+++ b/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Startup.cs
@@ -37,6 +37,8 @@ namespace Wasm.Authentication.Server
services.AddAuthentication()
.AddIdentityServerJwt();
+ services.AddWebAssemblyStaticFilesConfiguration();
+
services.AddMvc();
services.AddResponseCompression(opts =>
{
@@ -57,7 +59,6 @@ namespace Wasm.Authentication.Server
}
app.UseStaticFiles();
- app.UseClientSideBlazorFiles();
app.UseRouting();
@@ -69,7 +70,7 @@ namespace Wasm.Authentication.Server
{
endpoints.MapControllers();
endpoints.MapRazorPages();
- endpoints.MapFallbackToClientSideBlazor("index.html");
+ endpoints.MapFallbackToFile("index.html");
});
}
}
diff --git a/src/Components/test/E2ETest/Tests/BootResourceCachingTest.cs b/src/Components/test/E2ETest/Tests/BootResourceCachingTest.cs
index f20e11220a..941a99c253 100644
--- a/src/Components/test/E2ETest/Tests/BootResourceCachingTest.cs
+++ b/src/Components/test/E2ETest/Tests/BootResourceCachingTest.cs
@@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Tests
ITestOutputHelper output)
: base(browserFixture, serverFixture, output)
{
- serverFixture.BuildWebHostMethod = HostedInAspNet.Server.Program.BuildWebHost;
+ serverFixture.BuildWebHostMethod = Program.BuildWebHost;
}
public override Task InitializeAsync()
@@ -57,7 +57,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Tests
var subsequentResourcesRequested = GetAndClearRequestedPaths();
Assert.NotEmpty(initialResourcesRequested.Where(path => path.EndsWith("/blazor.boot.json")));
Assert.Empty(subsequentResourcesRequested.Where(path => path.EndsWith("/dotnet.wasm")));
- Assert.NotEmpty(subsequentResourcesRequested.Where(path => path.EndsWith(".js")));
+ Assert.Empty(subsequentResourcesRequested.Where(path => path.EndsWith(".js")));
Assert.Empty(subsequentResourcesRequested.Where(path => path.EndsWith(".dll")));
}
diff --git a/src/Components/test/testassets/ComponentsApp.Server/appsettings.json b/src/Components/test/testassets/ComponentsApp.Server/appsettings.json
index 26bb0ac7ac..c851e129f9 100644
--- a/src/Components/test/testassets/ComponentsApp.Server/appsettings.json
+++ b/src/Components/test/testassets/ComponentsApp.Server/appsettings.json
@@ -1,4 +1,4 @@
-{
+{
"Logging": {
"IncludeScopes": false,
"Debug": {
diff --git a/src/Components/test/testassets/TestServer/AuthenticationStartup.cs b/src/Components/test/testassets/TestServer/AuthenticationStartup.cs
index 5c33de8d2d..a395dad910 100644
--- a/src/Components/test/testassets/TestServer/AuthenticationStartup.cs
+++ b/src/Components/test/testassets/TestServer/AuthenticationStartup.cs
@@ -27,6 +27,9 @@ namespace TestServer
services.AddMvc();
services.AddServerSideBlazor();
+
+ services.AddWebAssemblyStaticFilesConfiguration();
+
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
services.AddAuthorization(options =>
{
@@ -49,7 +52,6 @@ namespace TestServer
app.Map("/subdir", app =>
{
app.UseStaticFiles();
- app.UseClientSideBlazorFiles();
app.UseRouting();
app.UseEndpoints(endpoints =>
@@ -66,7 +68,7 @@ namespace TestServer
public class AuthenticationStartup : AuthenticationStartupBase
{
public AuthenticationStartup(IConfiguration configuration)
- : base(configuration, (endpoints) => endpoints.MapFallbackToClientSideBlazor("index.html"))
+ : base(configuration, (endpoints) => endpoints.MapFallbackToFile("index.html"))
{
}
}
diff --git a/src/Components/test/testassets/TestServer/ClientStartup.cs b/src/Components/test/testassets/TestServer/ClientStartup.cs
index 3dd550fc6d..6381adc921 100644
--- a/src/Components/test/testassets/TestServer/ClientStartup.cs
+++ b/src/Components/test/testassets/TestServer/ClientStartup.cs
@@ -23,6 +23,7 @@ namespace TestServer
{
services.AddMvc();
services.AddServerSideBlazor();
+ services.AddWebAssemblyStaticFilesConfiguration();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -37,7 +38,6 @@ namespace TestServer
app.Map("/subdir", app =>
{
// Add it before to ensure it takes priority over files in wwwroot
- app.UseClientSideBlazorFiles();
app.UseStaticFiles();
app.UseRouting();
@@ -45,7 +45,7 @@ namespace TestServer
{
endpoints.MapRazorPages();
endpoints.MapControllers();
- endpoints.MapFallbackToClientSideBlazor("index.html");
+ endpoints.MapFallbackToFile("index.html");
});
});
}
diff --git a/src/Components/test/testassets/TestServer/CorsStartup.cs b/src/Components/test/testassets/TestServer/CorsStartup.cs
index 28dda32d90..0ae0a13c8a 100644
--- a/src/Components/test/testassets/TestServer/CorsStartup.cs
+++ b/src/Components/test/testassets/TestServer/CorsStartup.cs
@@ -19,6 +19,7 @@ namespace TestServer
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
+ services.AddWebAssemblyStaticFilesConfiguration();
services.AddCors(options =>
{
// It's not enough just to return "Access-Control-Allow-Origin: *", because
@@ -46,7 +47,6 @@ namespace TestServer
app.Map("/subdir", app =>
{
app.UseStaticFiles();
- app.UseClientSideBlazorFiles();
app.UseRouting();
@@ -55,7 +55,7 @@ namespace TestServer
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
- endpoints.MapFallbackToClientSideBlazor("index.html");
+ endpoints.MapFallbackToFile("index.html");
});
});
}
diff --git a/src/Components/test/testassets/TestServer/InternationalizationStartup.cs b/src/Components/test/testassets/TestServer/InternationalizationStartup.cs
index 7521ebe34b..752778f481 100644
--- a/src/Components/test/testassets/TestServer/InternationalizationStartup.cs
+++ b/src/Components/test/testassets/TestServer/InternationalizationStartup.cs
@@ -23,6 +23,7 @@ namespace TestServer
{
services.AddMvc();
services.AddServerSideBlazor();
+ services.AddWebAssemblyStaticFilesConfiguration();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -37,7 +38,6 @@ namespace TestServer
app.Map("/subdir", app =>
{
app.UseStaticFiles();
- app.UseClientSideBlazorFiles();
app.UseRequestLocalization(options =>
{
diff --git a/src/Components/test/testassets/TestServer/StartupWithMapFallbackToClientSideBlazor.cs b/src/Components/test/testassets/TestServer/StartupWithMapFallbackToClientSideBlazor.cs
index d32f48f8e3..1b30089b16 100644
--- a/src/Components/test/testassets/TestServer/StartupWithMapFallbackToClientSideBlazor.cs
+++ b/src/Components/test/testassets/TestServer/StartupWithMapFallbackToClientSideBlazor.cs
@@ -1,11 +1,8 @@
// 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 BasicTestApp;
using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Components.Server;
using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@@ -24,6 +21,7 @@ namespace TestServer
public void ConfigureServices(IServiceCollection services)
{
+ services.AddWebAssemblyStaticFilesConfiguration();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
@@ -36,7 +34,7 @@ namespace TestServer
// The client-side files middleware needs to be here because the base href in hardcoded to /subdir/
app.Map("/subdir", app =>
{
- app.UseClientSideBlazorFiles();
+ app.UseStaticFiles();
});
// The calls to `Map` allow us to test each of these overloads, while keeping them isolated.
@@ -46,7 +44,7 @@ namespace TestServer
app.UseEndpoints(endpoints =>
{
- endpoints.MapFallbackToClientSideBlazor("index.html");
+ endpoints.MapFallbackToFile("index.html");
});
});
@@ -56,7 +54,7 @@ namespace TestServer
app.UseEndpoints(endpoints =>
{
- endpoints.MapFallbackToClientSideBlazor("test/{*path:nonfile}", "index.html");
+ endpoints.MapFallbackToFile("test/{*path:nonfile}", "index.html");
});
});
@@ -66,7 +64,7 @@ namespace TestServer
app.UseEndpoints(endpoints =>
{
- endpoints.MapFallbackToClientSideBlazor(typeof(BasicTestApp.Program).Assembly.Location, "index.html");
+ endpoints.MapFallbackToFile("index.html");
});
});
@@ -76,7 +74,7 @@ namespace TestServer
app.UseEndpoints(endpoints =>
{
- endpoints.MapFallbackToClientSideBlazor(typeof(BasicTestApp.Program).Assembly.Location, "test/{*path:nonfile}", "index.html");
+ endpoints.MapFallbackToFile("test/{*path:nonfile}", "index.html");
});
});
}
diff --git a/src/ProjectTemplates/ComponentsWebAssembly.ProjectTemplates/ComponentsWebAssembly-CSharp.Client.csproj.in b/src/ProjectTemplates/ComponentsWebAssembly.ProjectTemplates/ComponentsWebAssembly-CSharp.Client.csproj.in
index 18cb3bca5a..774f43300a 100644
--- a/src/ProjectTemplates/ComponentsWebAssembly.ProjectTemplates/ComponentsWebAssembly-CSharp.Client.csproj.in
+++ b/src/ProjectTemplates/ComponentsWebAssembly.ProjectTemplates/ComponentsWebAssembly-CSharp.Client.csproj.in
@@ -21,13 +21,10 @@
-
-
-
-
- PreserveNewest
- wwwroot\service-worker.js
-
+
+
+
+
diff --git a/src/ProjectTemplates/ComponentsWebAssembly.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Startup.cs b/src/ProjectTemplates/ComponentsWebAssembly.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Startup.cs
index 591d098974..1e2ccb8c5d 100644
--- a/src/ProjectTemplates/ComponentsWebAssembly.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Startup.cs
+++ b/src/ProjectTemplates/ComponentsWebAssembly.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Startup.cs
@@ -71,6 +71,8 @@ namespace ComponentsWebAssembly_CSharp.Server
services.AddRazorPages();
#endif
+ services.AddWebAssemblyStaticFilesConfiguration();
+
services.AddResponseCompression(opts =>
{
opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(
@@ -105,7 +107,6 @@ namespace ComponentsWebAssembly_CSharp.Server
#endif
app.UseStaticFiles();
- app.UseClientSideBlazorFiles();
app.UseRouting();
@@ -126,7 +127,7 @@ namespace ComponentsWebAssembly_CSharp.Server
#endif
endpoints.MapControllers();
- endpoints.MapFallbackToClientSideBlazor("index.html");
+ endpoints.MapFallbackToFile("index.html");
});
}
}
diff --git a/src/ProjectTemplates/test/BlazorWasmTemplateTest.cs b/src/ProjectTemplates/test/BlazorWasmTemplateTest.cs
index d0316b4469..fe0260e370 100644
--- a/src/ProjectTemplates/test/BlazorWasmTemplateTest.cs
+++ b/src/ProjectTemplates/test/BlazorWasmTemplateTest.cs
@@ -56,7 +56,7 @@ namespace Templates.Test
private ProcessEx RunPublishedStandaloneBlazorProject(Project project)
{
- var publishDir = Path.Combine(project.TemplatePublishDir, project.ProjectName, "dist");
+ var publishDir = Path.Combine(project.TemplatePublishDir, "wwwroot");
AspNetProcess.EnsureDevelopmentCertificates();
Output.WriteLine("Running dotnet serve on published output...");
@@ -123,7 +123,7 @@ namespace Templates.Test
await BuildAndRunTest(project.ProjectName, project);
- var publishDir = Path.Combine(project.TemplatePublishDir, project.ProjectName, "dist");
+ var publishDir = Path.Combine(project.TemplatePublishDir, "wwwroot");
// When publishing the PWA template, we generate an assets manifest
// and move service-worker.published.js to overwrite service-worker.js