Rendere il vostro ASP.NET Core Website un PWA (Italiano (Italian))

Rendere il vostro ASP.NET Core Website un PWA

Thursday, 01 August 2024

//

Less than a minute

In questo articolo vi mostrerò come rendere il vostro sito web ASP.NET Core una PWA (Progressive Web App).

Prerequisiti

È molto semplice vedere https://github.com/madskristensen/WebEssentials.AspNetCore.ServiceWorker/tree/master

ASP.NET Bits

Installa il pacchetto Nuget

dotnet add package WebEssentials.AspNetCore.PWA

Nel vostro programma.cs aggiungere:

builder.Services.AddProgressiveWebApp();

Poi creare alcuni favicon che corrispondono alle dimensioni qui sotto qui è uno strumento che puoi usare per crearli. Questi possono davvero essere qualsiasi icona (Ho usato un emoji)

Save these in your wwrroot folder as android-chrome-192x192.png and android-chrome-512x512.png (in the example below)

Allora hai bisogno di un manifesto.Json

{
  "name": "mostlylucid",
  "short_name": "mostlylucid",
  "description": "The web site for mostlylucid limited",
  "icons": [
    {
      "src": "/android-chrome-192x192.png",
      "sizes": "192x192"
    },
    {
      "src": "/android-chrome-512x512.png",
      "sizes": "512x512"
    }
  ],
  "display": "standalone",
  "start_url": "/"
}
Finding related posts...
logo

© 2026 Scott Galloway — Unlicense — All content and source code on this site is free to use, copy, modify, and sell.