Skip to content

Commit 7315ca3

Browse files
Rick-Andersontdykstraguardrex
authored
Feature static asset deliver /2 (#34055)
* Feature static asset deliver /2 * Feature static asset deliver /2 * Apply suggestions from code review Co-authored-by: Tom Dykstra <[email protected]> Co-authored-by: Luke Latham <[email protected]> --------- Co-authored-by: Tom Dykstra <[email protected]> Co-authored-by: Luke Latham <[email protected]>
1 parent b34bd1b commit 7315ca3

File tree

4 files changed

+10
-21
lines changed

4 files changed

+10
-21
lines changed

aspnetcore/migration/80-90.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ In MVC & Razor Pages apps you additionally need to chain a call to `.WithStaticA
8383

8484
ASP.NET Core automatically fingerprints and precompresses your static files at build and publish time, and then <xref:Microsoft.AspNetCore.Builder.StaticAssetsEndpointRouteBuilderExtensions.MapStaticAssets%2A> surfaces the optimized files as endpoints using endpoint routing with appropriate caching headers.
8585

86-
87-
8886
To resolve the fingerprinted file names from your app:
8987

9088
* In Blazor apps, use the <xref:Microsoft.AspNetCore.Components.ComponentBase.Assets?displayProperty=nameWithType> property. Update explicit references to static assets in Razor component files (`.razor`) to use `@Assets["{ASSET PATH}"]`, where the `{ASSET PATH}` placeholder is the path to the asset. Note that this should ***NOT*** be done for the Blazor framework scripts (`blazor.*.js`). In the following example, Bootstrap, the Blazor project template app stylesheet (`app.css`), and the [CSS isolation stylesheet](xref:blazor/components/css-isolation) (based on an app's namespace of `BlazorSample`) are linked in a root component, typically the `App` component (`Components/App.razor`):
@@ -94,7 +92,7 @@ To resolve the fingerprinted file names from your app:
9492
<link rel="stylesheet" href="@Assets["app.css"]" />
9593
<link rel="stylesheet" href="@Assets["BlazorSample.styles.css"]" />
9694
```
97-
95+
9896
* In MVC & Razor Pages apps, the script and link tag helpers will automatically resolve the fingerprinted file names.
9997
10098
To resolve the fingerprinted file names when importing JavaScript modules, add a generated [import map](https://developer.mozilla.org/docs/Web/HTML/Element/script/type/importmap):

aspnetcore/release-notes/aspnetcore-9.0.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ uid: aspnetcore-9
1111

1212
This article highlights the most significant changes in ASP.NET Core 9.0 with links to relevant documentation.
1313

14-
This article has been updated for .NET 9 Release Candidate 2.
14+
## Static asset delivery optimization
1515

16-
<!-- New content should be added to ~/aspnetcore-9/includes/newFeatureName.md files. This will help prevent merge conflicts in this file. -->
16+
[MapStaticAssets routing endpoint conventions](xref:Microsoft.AspNetCore.Builder.StaticAssetsEndpointRouteBuilderExtensions.MapStaticAssets%2A) is a new feature that optimizes the delivery of static assets in ASP.NET Core apps.
17+
18+
For information on static asset delivery for Blazor apps, see <xref:blazor/fundamentals/static-files?view=aspnetcore-9.0>.
19+
20+
[!INCLUDE[](~/release-notes/aspnetcore-9/includes/web_asset_delivery.md)]
1721

1822
## Blazor
1923

@@ -69,8 +73,6 @@ The following sections describe miscellaneous new features.
6973

7074
[!INCLUDE[](~/release-notes/aspnetcore-9/includes/fix-for-503s.md)]
7175

72-
[!INCLUDE[](~/release-notes/aspnetcore-9/includes/web_asset_delivery.md)]
73-
7476
[!INCLUDE[](~/release-notes/aspnetcore-9/includes/asp0026.md)]
7577

7678
[!INCLUDE[](~/release-notes/aspnetcore-9/includes/improved-kestrel-connection-metrics.md)]

aspnetcore/release-notes/aspnetcore-9/includes/blazor.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### .NET MAUI Blazor Hybrid and Web App solution template
22

3-
A new solution template makes it easier to create .NET MAUI native and Blazor web client apps that share the same UI. This template shows how to create client apps that maximize code reuse and target Android, iOS, Mac, Windows, and Web.
3+
A new solution template makes it easier to create .NET MAUI native and Blazor web client apps that share the same UI. This template shows how to create client apps that maximize code reuse and target Android, iOS, Mac, Windows, and Web.
44

55
Key features of this template include:
66

@@ -28,20 +28,11 @@ The template is also available in Visual Studio.
2828
2929
For more information, see <xref:blazor/hybrid/tutorials/maui-blazor-web-app?view=aspnetcore-9.0>.
3030

31-
### Static asset delivery optimization
32-
33-
Map Static Assets routing endpoint conventions (<xref:Microsoft.AspNetCore.Builder.StaticAssetsEndpointRouteBuilderExtensions.MapStaticAssets%2A>) is a new feature that helps optimize the delivery of static assets in any ASP.NET Core app, including Blazor apps.
34-
35-
For more information, see the following resources:
36-
37-
* The [Optimize static web asset delivery](#optimize-static-web-asset-delivery) section of this article.
38-
* <xref:blazor/fundamentals/static-files?view=aspnetcore-9.0>.
39-
4031
### Detect rendering location, interactivity, and assigned render mode at runtime
4132

4233
We've introduced a new API designed to simplify the process of querying component states at runtime. This API provides the following capabilities:
4334

44-
* **Determine the current execution location of the component**: This can be particularly useful for debugging and optimizing component performance.
35+
* **Determine the current execution location of the component**: This can be useful for debugging and optimizing component performance.
4536
* **Check if the component is running in an interactive environment**: This can be helpful for components that have different behaviors based on the interactivity of their environment.
4637
* **Retrieve the assigned render mode for the component**: Understanding the render mode can help in optimizing the rendering process and improving the overall performance of a component.
4738

@@ -232,6 +223,6 @@ The <xref:Microsoft.AspNetCore.Components.Forms.InputNumber%601> component now s
232223

233224
<!-- UPDATE 10.0 Confirm or update -->
234225

235-
Support for multiple Blazor Web Apps per server project will be considered for .NET 10 (November, 2025).
226+
Support for multiple Blazor Web Apps per server project is under consideration for .NET 10 in late 2025.
236227

237228
For more information, see [Support for multiple Blazor Web apps per server project (`dotnet/aspnetcore` #52216)](https://github.com/dotnet/aspnetcore/issues/52216).

aspnetcore/release-notes/aspnetcore-9/includes/web_asset_delivery.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
### Optimize static web asset delivery
2-
31
Following production best practices for serving static assets requires a significant amount of work and technical expertise. Without optimizations like compression, caching, and [fingerprints](https://en.wikipedia.org/wiki/Fingerprint_(computing)):
42

53
* The browser has to make additional requests on every page load.

0 commit comments

Comments
 (0)