Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 37 additions & 9 deletions aspnetcore/blazor/project-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -540,19 +540,27 @@ The project structure of the client-side app in a hosted Blazor Webassembly solu

The Blazor script is served as a static web asset with automatic compression and fingerprinting. For more information, see <xref:blazor/fundamentals/static-files>.

:::moniker-end
In a Blazor Web App, the Blazor script is located in the `Components/App.razor` file:

:::moniker range="< aspnetcore-10.0"
```razor
<script src="@Assets["_framework/blazor.web.js"]"></script>
```

The Blazor script is served from an embedded resource in the ASP.NET Core shared framework.
In a Blazor Server app, the Blazor script is located in the `Pages/_Host.cshtml` file:

```html
<script src="_framework/blazor.server.js"></script>
```

:::moniker-end

:::moniker range=">= aspnetcore-8.0"
:::moniker range=">= aspnetcore-8.0 < aspnetcore-10.0"

The Blazor script is served from an embedded resource in the ASP.NET Core shared framework.

In a Blazor Web App, the Blazor script is located in the `Components/App.razor` file:

```html
```razor
<script src="_framework/blazor.web.js"></script>
```

Expand All @@ -566,6 +574,8 @@ In a Blazor Server app, the Blazor script is located in the `Pages/_Host.cshtml`

:::moniker range=">= aspnetcore-7.0 < aspnetcore-8.0"

The Blazor script is served from an embedded resource in the ASP.NET Core shared framework.

In a Blazor Server app, the Blazor script is located in the `Pages/_Host.cshtml` file:

```html
Expand All @@ -576,6 +586,8 @@ In a Blazor Server app, the Blazor script is located in the `Pages/_Host.cshtml`

:::moniker range=">= aspnetcore-6.0 < aspnetcore-7.0"

The Blazor script is served from an embedded resource in the ASP.NET Core shared framework.

In a Blazor Server app, the Blazor script is located in the `Pages/_Layout.cshtml` file:

```html
Expand All @@ -586,6 +598,8 @@ In a Blazor Server app, the Blazor script is located in the `Pages/_Layout.cshtm

:::moniker range="< aspnetcore-6.0"

The Blazor script is served from an embedded resource in the ASP.NET Core shared framework.

In a Blazor Server app, the Blazor script is located in the `Pages/_Host.cshtml` file:

```html
Expand All @@ -594,18 +608,32 @@ In a Blazor Server app, the Blazor script is located in the `Pages/_Host.cshtml`

:::moniker-end

For a Blazor Web App or a Blazor Server app, the project must contain at least one Razor component file (`.razor`) in order to automatically include the Blazor script when the app is published. If the project doesn't contain at least one Razor component, set the `RequiresAspNetWebAssets` MSBuild property to `true` in the app's project file to include the Blazor script:

```xml
<RequiresAspNetWebAssets>true</RequiresAspNetWebAssets>
```

In a Blazor WebAssembly app, the Blazor script content is located in the `wwwroot/index.html` file:

:::moniker range=">= aspnetcore-10.0"

```html
<script src="_framework/blazor.webassembly.js"></script>
<script src="_framework/blazor.webassembly#[.{fingerprint}].js"></script>
```

For a Blazor Web App or a Blazor Server app, the project must contain at least one Razor component file (`.razor`) in order to automatically include the Blazor script when the app is published. If the project doesn't contain at least one Razor component, set the `RequiresAspNetWebAssets` MSBuild property `true` in the app's project file to include the Blazor script:
When the app is published, the `{fingerprint}` placeholder is automatically replaced with a unique hash for cache busting.

```xml
<RequiresAspNetWebAssets>true</RequiresAspNetWebAssets>
:::moniker-end

:::moniker range="< aspnetcore-10.0"

```html
<script src="_framework/blazor.webassembly.js"></script>
```

:::moniker-end

## Location of `<head>` and `<body>` content

:::moniker range=">= aspnetcore-8.0"
Expand Down