Skip to content

Commit 5f71031

Browse files
authored
Merge pull request #35934 from dotnet/main
2 parents a7eda0e + 50a7003 commit 5f71031

File tree

101 files changed

+1151
-1094
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+1151
-1094
lines changed

.github/copilot-instructions.md

Lines changed: 68 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
author: wadepickett
33
ms.author: wpickett
4-
ms.date: 07-31-2025
4+
ms.date: 08-17-2025
55
---
66

77
# Copilot Instructions for `dotnet/AspNetCore.Docs`
@@ -31,18 +31,40 @@ When creating a PR for an issue:
3131
- If you cannot verify, state that explicitly in your output.
3232

3333
### Links and References
34-
- Use relative links (for example, `../folder/file.md` or `./file.md`) when referencing files within this repository. Do not use absolute URLs or GitHub web links for internal content.
35-
- For external links, always remove any language or culture segment from the URL path (such as `/en-us/`, `/fr-fr/`, `/en/`, etc.).
36-
- Example (Microsoft Learn):
37-
- Original: `https://learn.microsoft.com/en-us/aspnet/core/blazor/`
38-
- Correct: `https://learn.microsoft.com/aspnet/core/blazor/`
39-
- Example (Wikipedia):
40-
- Original: `https://en.wikipedia.org/wiki/ASP.NET_Core`
41-
- Correct: `https://wikipedia.org/wiki/ASP.NET_Core`
42-
- For Microsoft Learn links, also strip the base domain (`https://learn.microsoft.com/en-us`) so only the path remains.
43-
- Example:
44-
- Original: `https://learn.microsoft.com/en-us/aspnet/core/blazor/`
45-
- Correct: `/aspnet/core/blazor/`
34+
- For cross-references to other articles within the AspNetCore.Docs repository:
35+
- Use the xref syntax: `<xref:target-uid>`
36+
- The "target-uid" of the xref syntax is obtained from the `uid` property value in the YAML front matter of the article's markdown file
37+
- Examples
38+
- For a target article `uid` value of `aspnetcore/mvc/overview`, the xref cross-link is `<xref:aspnetcore/mvc/overview>`
39+
- For a target article `uid` value of `blazor/index`, the xref cross-link is `<xref:blazor/index>`
40+
41+
- For non-markdown files (files that don't have the `.md` file extension) within this repository, such as PowerShell scripts and code files:
42+
- Use relative links with the appropriate file extension
43+
- Example: `../build-tools/build.ps1` or `./sample.json`
44+
45+
- For external links to non-Microsoft sites (MDN, W3C, etc.):
46+
- Use absolute URLs
47+
- Remove any language or culture segment from the URL path (such as `/en-us/`, `/fr-fr/`, `/en/`, etc.)
48+
- Example (MDN):
49+
- Original: `https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event`
50+
- Correct: `https://developer.mozilla.org/docs/Web/API/Element/click_event`
51+
52+
- For links to GitHub repositories:
53+
- Use the full URL path
54+
- Example: `https://github.com/maraf/blazor-wasm-react/blob/main/blazor/Counter.razor`
55+
- Example: `https://github.com/dotnet/blazor-samples/blob/main/10.0/BlazorWebAssemblyReact/blazor/Counter.razor`
56+
- For other Git hosting services or non-Microsoft domains, use the full URL
57+
- Example: `https://gitlab.com/username/repo-name`
58+
59+
- For links to Microsoft Learn content in other repositories:
60+
- Use the relative URL starting with a forward slash
61+
- Don't include the scheme and the host (example: `https://learn.microsoft.com`) and don't include the locale (example: `en-us`)
62+
- Example: For the target Learn website URL `https://learn.microsoft.com/en-us/dotnet/core/introduction`, use the relative URL `/dotnet/core/introduction` for the link destination
63+
64+
- Never use physical .md file paths in published content
65+
- Wrong: `../blazor/index.md` or `/aspnet/core/blazor/index.md`
66+
- Correct: `<xref:blazor/index>`
67+
- Exception: GitHub-only content (such as README files, contributing guidelines, and other repository documentation that isn't published to learn.microsoft.com) should use an absolute URL to the markdown file (`.md` file extension)
4668

4769
## Repository-Specific Guidelines
4870
- Follow the [Microsoft Writing Style Guide](https://learn.microsoft.com/en-us/style-guide/welcome/)
@@ -54,14 +76,37 @@ When creating a PR for an issue:
5476
- For any new or updated .md file added to the repository, ensure the following frontmatter (metadata) is included:
5577
- Metadata `ai-usage: ai-assisted` if any AI assistance was used
5678
- Place the title metadata first, followed by the remaining metadata lines in alphabetical order. Example: `title`, `author`, `description`, `monikerRange`, `ms.author`, `ms.custom`, `ms.date`, `uid`, `zone_pivot_groups`
57-
- Metadata `ms.date: <today's date>` with a format of MM-DD-YYYY. If the file already has a `ms.date` metadata, update it to today's date if more than 50 characters are changed in the file.
79+
- Metadata `ms.date: <today's date>` with a format of MM/DD/YYYY. If the file already has a `ms.date` metadata, update it to today's date if more than 50 characters are changed in the file.
5880

5981
### Version Targeting Common Range Patterns
6082
- Fixed Range: `>= aspnetcore-7.0 <= aspnetcore-9.0`
6183
- Open Upper Bound: `>= aspnetcore-7.0`
6284
- Open Lower Bound: `<= aspnetcore-9.0`
6385
- Specific Version: `== aspnetcore-9.0`
6486

87+
### Handling File Redirections
88+
- When a Markdown (.md) article file (this does not apply to includes) is deleted in a PR, create a redirection entry.
89+
- Redirections ensure users following existing links aren't left with broken links
90+
- To add a redirection:
91+
1. Update the `.openpublishing.redirection.json` file at the repository root
92+
2. Follow this format for new entries:
93+
```json
94+
{
95+
"source_path": "aspnetcore/path/to/deleted-file.md",
96+
"redirect_url": "/aspnet/core/path/to/target-file",
97+
"redirect_document_id": false
98+
}
99+
```
100+
3. Use relative URLs for redirection to pages in the `learn.microsoft.com` domain
101+
- Example: `/aspnet/core/path/to/target-file`
102+
4. For URLs in a different domain, use absolute URLs including the domain.
103+
- Example: `https://learn.microsoft.com/dotnet/core/introduction`
104+
5. Set `redirect_document_id` to `false` unless specifically instructed otherwise
105+
6. Maintain alphabetical order of the `source_path` entries for better organization
106+
7. Ensure proper JSON formatting with correct commas between entries
107+
- When selecting a redirect target, choose the most relevant existing content that would serve the user's original intent
108+
- If no direct replacement exists, redirect to a parent category page or related topic
109+
65110
### Code Snippets
66111
- For code snippets longer than 6 lines:
67112
1. Create a subfolder named after the document the snippet supports.
@@ -90,15 +135,15 @@ When creating a PR for an issue:
90135
- Use the following language code and indentation standards for markdown code blocks or the `language` attribute of code snippets:
91136
92137
Content of the snippet | Language code | Indentation in spaces
93-
:---: | :---: | :---:
94-
C# | csharp | 4
95-
HTML | html | 4
96-
CSS | css | 4
97-
JavaScript | javascript | 2 spaces (use 4 spaces for line continuation)
98-
XML | xml | 2
99-
JSON | json | 2
100-
Console | console | 2
101-
Text | - | 2
138+
:--------------------: | :-----------: | :-------------------:
139+
C# | csharp | 4
140+
HTML | html | 4
141+
CSS | css | 4
142+
JavaScript | javascript | 2 spaces (use 4 spaces for line continuation)
143+
XML | xml | 2
144+
JSON | json | 2
145+
Console | console | 2
146+
Text | - | 2
102147
103148
### ASP.NET Core Specific Guidelines
104149
- Use the latest supported version for examples unless otherwise specified

.openpublishing.redirection.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,31 @@
16281628
"source_path": "aspnetcore/blazor/state-management.md",
16291629
"redirect_url": "/aspnet/core/state-management/",
16301630
"redirect_document_id": false
1631+
},
1632+
{
1633+
"source_path": "aspnetcore/fundamentals/includes/apis6.md",
1634+
"redirect_url": "/aspnet/core/fundamentals/apis",
1635+
"redirect_document_id": false
1636+
},
1637+
{
1638+
"source_path": "aspnetcore/fundamentals/minimal-apis/handle-errors.md",
1639+
"redirect_url": "/aspnet/core/fundamentals/error-handling-api",
1640+
"redirect_document_id": false
1641+
},
1642+
{
1643+
"source_path": "aspnetcore/fundamentals/minimal-apis/overview.md",
1644+
"redirect_url": "/aspnet/core/fundamentals/apis",
1645+
"redirect_document_id": false
1646+
},
1647+
{
1648+
"source_path": "aspnetcore/web-api/handle-errors.md",
1649+
"redirect_url": "/aspnet/core/fundamentals/error-handling-api",
1650+
"redirect_document_id": false
1651+
},
1652+
{
1653+
"source_path": "aspnetcore/fundamentals/handle-errors.md",
1654+
"redirect_url": "/aspnet/core/fundamentals/error-handling-api",
1655+
"redirect_document_id": false
16311656
}
16321657
]
16331658
}

aspnetcore/blazor/components/component-disposal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ uid: blazor/components/component-disposal
1212

1313
[!INCLUDE[](~/includes/not-latest-version.md)]
1414

15-
This article explains the ASP.NET Core Razor component disposal with with <xref:System.IDisposable> and <xref:System.IAsyncDisposable>.
15+
This article explains the ASP.NET Core Razor component disposal process with <xref:System.IDisposable> and <xref:System.IAsyncDisposable>.
1616

1717
If a component implements <xref:System.IDisposable> or <xref:System.IAsyncDisposable>, the framework calls for resource disposal when the component is removed from the UI. Don't rely on the exact timing of when these methods are executed. For example, <xref:System.IAsyncDisposable> can be triggered before or after an asynchronous <xref:System.Threading.Tasks.Task> awaited in [`OnInitalizedAsync`](xref:blazor/components/lifecycle#component-initialization-oninitializedasync) or [`OnParametersSetAsync`](xref:blazor/components/lifecycle#after-parameters-are-set-onparameterssetasync) is called or completes. Also, object disposal code shouldn't assume that objects created during initialization or other lifecycle methods exist.
1818

aspnetcore/blazor/forms/validation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ app.MapDefaultControllerRoute();
597597
For more information on controller routing and validation failure error responses, see the following resources:
598598

599599
* <xref:mvc/controllers/routing>
600-
* <xref:web-api/handle-errors#validation-failure-error-response>
600+
* <xref:fundamentals/error-handling-api#validation-failure-error-response>
601601

602602
In the `.Client` project, add the `CustomValidation` component shown in the [Validator components](#validator-components) section. Update the namespace to match the app (for example, `namespace BlazorSample.Client`).
603603

aspnetcore/blazor/host-and-deploy/index.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,7 @@ When `WasmBundlerFriendlyBootConfig` is enabled, the produced JS contains `impor
133133
134134
The following sample apps are based on [Rollup](https://rollupjs.org/). Similar concepts apply when using other JS bundlers.
135135

136-
Demonstration sample apps:
137-
138-
* [Blazor WASM in a React application (`maraf/blazor-wasm-react` GitHub repository)](https://github.com/maraf/blazor-wasm-react)
139-
* [.NET on WASM in a React component sample (`maraf/dotnet-wasm-react` GitHub repository)](https://github.com/maraf/dotnet-wasm-react)
136+
Demonstration sample apps for Blazor WebAssembly in a React app (`BlazorWebAssemblyReact`) and .NET on WebAssembly in a React app (`DotNetWebAssemblyReact`) for .NET 10 or later are available in the [Blazor samples GitHub repository (`dotnet/blazor-samples`)](https://github.com/dotnet/blazor-samples).
140137

141138
:::moniker-end
142139

aspnetcore/blazor/javascript-interoperability/call-javascript-from-dotnet.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,8 @@ IJSRuntime JS { get; set; }
462462

463463
Create an instance of a JS object using a constructor function and get the <xref:Microsoft.JSInterop.IJSObjectReference>/<xref:Microsoft.JSInterop.IJSInProcessObjectReference> .NET handle for referencing the instance with the following API:
464464

465-
* `InvokeNewAsync` (asynchronous)
466-
* `InvokeNew` (synchronous)
465+
* `InvokeConstructorAsync` (asynchronous)
466+
* `InvokeConstructor` (synchronous)
467467

468468
Examples in this section demonstrate the API calls with the following `TestClass` with a constructor function (`constructor(text)`):
469469

@@ -479,25 +479,25 @@ window.TestClass = class {
479479
}
480480
```
481481

482-
### Asynchronous `InvokeNewAsync`
482+
### Asynchronous `InvokeConstructorAsync`
483483

484-
Use `InvokeNewAsync(string identifier, object?[]? args)` on <xref:Microsoft.JSInterop.IJSRuntime> and <xref:Microsoft.JSInterop.IJSObjectReference> to invoke the specified JS constructor function asynchronously. The function is invoked with the `new` operator. In the following example, `TestClass` contains a constructor function, and `classRef` is an <xref:Microsoft.JSInterop.IJSObjectReference>.
484+
Use `InvokeConstructorAsync(string identifier, object?[]? args)` on <xref:Microsoft.JSInterop.IJSRuntime> and <xref:Microsoft.JSInterop.IJSObjectReference> to invoke the specified JS constructor function asynchronously. The function is invoked with the `new` operator. In the following example, `TestClass` contains a constructor function, and `classRef` is an <xref:Microsoft.JSInterop.IJSObjectReference>.
485485

486486
```csharp
487-
var classRef = await JSRuntime.InvokeNewAsync("TestClass", "Blazor!");
487+
var classRef = await JSRuntime.InvokeConstructorAsync("TestClass", "Blazor!");
488488
var text = await classRef.GetValueAsync<string>("text");
489489
var textLength = await classRef.InvokeAsync<int>("getTextLength");
490490
```
491491

492492
An overload is available that takes a <xref:System.Threading.CancellationToken> argument or <xref:System.TimeSpan> timeout argument.
493493

494-
### Synchronous `InvokeNew`
494+
### Synchronous `InvokeConstructor`
495495

496-
Use `InvokeNew(string identifier, object?[]? args)` on <xref:Microsoft.JSInterop.IJSInProcessRuntime> and <xref:Microsoft.JSInterop.IJSInProcessObjectReference> to invoke the specified JS constructor function synchronously. The function is invoked with the `new` operator. In the following example, `TestClass` contains a constructor function, and `classRef` is an <xref:Microsoft.JSInterop.IJSInProcessObjectReference>:
496+
Use `InvokeConstructor(string identifier, object?[]? args)` on <xref:Microsoft.JSInterop.IJSInProcessRuntime> and <xref:Microsoft.JSInterop.IJSInProcessObjectReference> to invoke the specified JS constructor function synchronously. The function is invoked with the `new` operator. In the following example, `TestClass` contains a constructor function, and `classRef` is an <xref:Microsoft.JSInterop.IJSInProcessObjectReference>:
497497

498498
```csharp
499499
var inProcRuntime = ((IJSInProcessRuntime)JSRuntime);
500-
var classRef = inProcRuntime.InvokeNew("TestClass", "Blazor!");
500+
var classRef = inProcRuntime.InvokeConstructor("TestClass", "Blazor!");
501501
var text = classRef.GetValue<string>("text");
502502
var textLength = classRef.Invoke<int>("getTextLength");
503503
```
@@ -630,7 +630,7 @@ In server-side scenarios, JS interop calls can't be issued after Blazor's Signal
630630
* <xref:Microsoft.JSInterop.IJSRuntime.InvokeAsync%2A?displayProperty=nameWithType>
631631
* <xref:Microsoft.JSInterop.JSRuntimeExtensions.InvokeAsync%2A?displayProperty=nameWithType>
632632
* <xref:Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync%2A?displayProperty=nameWithType>
633-
* `InvokeNewAsync`
633+
* `InvokeConstructorAsync`
634634
* `GetValueAsync`
635635
* `SetValueAsync`
636636
* `Dispose`/`DisposeAsync` calls on any <xref:Microsoft.JSInterop.IJSObjectReference>.

aspnetcore/blazor/javascript-interoperability/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ JavaScript (JS) interop calls can't be issued after Blazor's SignalR circuit is
337337
* <xref:Microsoft.JSInterop.IJSRuntime.InvokeAsync%2A?displayProperty=nameWithType>
338338
* <xref:Microsoft.JSInterop.JSRuntimeExtensions.InvokeAsync%2A?displayProperty=nameWithType>
339339
* <xref:Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync%2A?displayProperty=nameWithType>
340-
* `InvokeNewAsync`
340+
* `InvokeConstructorAsync`
341341
* `GetValueAsync`
342342
* `SetValueAsync`
343343
* `Dispose`/`DisposeAsync` calls on any <xref:Microsoft.JSInterop.IJSObjectReference>.

aspnetcore/blazor/project-structure.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,12 @@ In a Blazor WebAssembly app, the Blazor script content is located in the `wwwroo
600600
<script src="_framework/blazor.webassembly.js"></script>
601601
```
602602

603+
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:
604+
605+
```xml
606+
<RequiresAspNetWebAssets>true</RequiresAspNetWebAssets>
607+
```
608+
603609
## Location of `<head>` and `<body>` content
604610

605611
:::moniker range=">= aspnetcore-8.0"
@@ -642,7 +648,7 @@ To create an app that can run as either a Blazor Server app or a Blazor WebAssem
642648

643649
* <xref:blazor/tooling>
644650
* <xref:blazor/hosting-models>
645-
* <xref:fundamentals/minimal-apis/overview>
651+
* <xref:fundamentals/apis>
646652
* [Blazor samples GitHub repository (`dotnet/blazor-samples`)](https://github.com/dotnet/blazor-samples) ([how to download](xref:blazor/fundamentals/index#sample-apps))
647653

648654
:::moniker-end

0 commit comments

Comments
 (0)