Convert an exisint Blazor WebAssemly app into a PWA
In the app's project file
Add the following ServiceWorkerAssetsManifest property to a PropertyGroup
<ServiceWorkerAssetsManifest >service-worker-assets.js</ServiceWorkerAssetsManifest >
Add ServiceWorker to Index.html
<!-- PWA --->
< script > navigator . serviceWorker . register ( 'service-worker.js' ) ; </ script >
<!-- PWA --->
Add icon and manifest.json to wwwroot (copy from blazor template project)
manifest.json
{
"name" : " Casino Asset Control" ,
"short_name" : " CAC" ,
"start_url" : " ./" ,
"display" : " standalone" ,
"background_color" : " #ffffff" ,
"theme_color" : " #03173d" ,
"prefer_related_applications" : false ,
"icons" : [
{
"src" : " icon-512.png" ,
"type" : " image/png" ,
"sizes" : " 512x512"
},
{
"src" : " icon-192.png" ,
"type" : " image/png" ,
"sizes" : " 192x192"
}
]
}
copy these files from template project wwwroot folder
icon-192.png
icon-512.png
service-worker.js
service-worker.published.js
Hosting in Azure, PWA seems don't work.
Blazor PWA Not Able to Install After Publishing on Azure Web Service
ASP.NET Core Blazor Progressive Web Application (PWA)