You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/migration/80-90.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,22 @@ In the project file, update each [`Microsoft.AspNetCore.*`](https://www.nuget.or
70
70
</ItemGroup>
71
71
```
72
72
73
+
## Replace UseStaticFiles with MapStaticAssets
74
+
75
+
Blazor has different update instructions than Razor Pages and ASP.NET Core MVC.
76
+
77
+
### Blazor
78
+
79
+
* Replace [UseStaticFiles](/dotnet/api/microsoft.aspnetcore.builder.staticfileextensions.usestaticfiles) with [MapStaticAssets](/dotnet/api/microsoft.aspnetcore.builder.staticassetsendpointroutebuilderextensions.mapstaticassets) in `Program.cs`
80
+
* Update explicit references to static assets in .razor files to use the `@Assets["asset-path"]` API. This should ***NOT*** be done for the Blazor framework scripts (`*blazor.\*.js*`)
81
+
* Update the root `App.razor` component to include the `<ImportMap />` component in the head.
82
+
83
+
### Razor Pages and ASP.NET Core MVC
84
+
85
+
* Replace [UseStaticFiles](/dotnet/api/microsoft.aspnetcore.builder.staticfileextensions.usestaticfiles) with [MapStaticAssets](/dotnet/api/microsoft.aspnetcore.builder.staticassetsendpointroutebuilderextensions.mapstaticassets) in `Program.cs`
86
+
* Chain a call to `.WithStaticAssets` after `MapRazorPages` or `MapControllerRoute` in `Program.cs`. For an example, see the <xref:fundamentals/static-files?view=aspnetcore-9.0&preserve-view=true>
87
+
* Add `<script type="importmap"></script>` to the head of the main layout file.
0 commit comments