Skip to content

Commit 56d4947

Browse files
BillWagnergewarren
andauthored
Remove source generators overview (#43206)
* Remove source generators overview The cookbook, from the roslyn SDK is a better choice. * Change the redirect to match our rules * Remove dependent files * Use clean-repo to replace links. Update all the links to the original target article. * Update docs/csharp/roslyn-sdk/index.md Co-authored-by: Genevieve Warren <[email protected]> --------- Co-authored-by: Genevieve Warren <[email protected]>
1 parent 533033d commit 56d4947

22 files changed

+24
-269
lines changed

.openpublishing.redirection.csharp.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4052,6 +4052,10 @@
40524052
"source_path_from_root": "/docs/csharp/roslyn/index.md",
40534053
"redirect_url": "/dotnet/csharp/roslyn-sdk/"
40544054
},
4055+
{
4056+
"source_path_from_root": "/docs/csharp/roslyn-sdk/source-generators-overview.md",
4057+
"redirect_url": "/dotnet/csharp/roslyn-sdk/#source-generators"
4058+
},
40554059
{
40564060
"source_path_from_root": "/docs/csharp/whats-new/tutorials/static-abstract-interface-methods.md",
40574061
"redirect_url": "/dotnet/csharp/whats-new/tutorials/static-virtual-interface-members"

docs/architecture/maui/mvvm-community-toolkit-features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ For more detailed information on implementing commands, see the section [Impleme
115115

116116
## Source Generators
117117

118-
Using the MVVM Toolkit components out-of-the-box allows you to greatly simplify our ViewModel. The MVVM Toolkit allows you to simplify common code use cases even further by using [Source Generators](../../csharp/roslyn-sdk/source-generators-overview.md). The MVVM Toolkit source generators look for specific attributes in our code and can generate wrappers for properties and commands.
118+
Using the MVVM Toolkit components out-of-the-box allows you to greatly simplify our ViewModel. The MVVM Toolkit allows you to simplify common code use cases even further by using [Source Generators](../../csharp/roslyn-sdk/index.md#source-generators). The MVVM Toolkit source generators look for specific attributes in our code and can generate wrappers for properties and commands.
119119

120120
> [!IMPORTANT]
121121
> The MVVM Toolkit Source Generators generate code that is additive to our existing objects. Because of this, any object that is leveraging a source generator will need to be marked as `partial`.

docs/core/docker/build-container.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ If you pass a number on the command line to the app, it will only count up to th
126126
127127
## Publish .NET app
128128

129-
In order for the app to be suitable for an image creation it has to be built. The `dotnet publish` command is most apt for this, as it builds and publishes the app. For an in-depth reference, see [dotnet build](/dotnet/core/tools/dotnet-build) and [dotnet publish](/dotnet/core/tools/dotnet-publish) commands documentation.
129+
In order for the app to be suitable for an image creation it has to be built. The `dotnet publish` command is most apt for this, as it builds and publishes the app. For an in-depth reference, see [dotnet build](../tools/dotnet-build.md) and [dotnet publish](../tools/dotnet-publish.md) commands documentation.
130130

131131
```dotnetcli
132132
dotnet publish -c Release

docs/core/extensions/configuration-generator.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.date: 10/09/2024
1010

1111
Starting with .NET 8, a configuration binding source generator was introduced that intercepts specific call sites and generates their functionality. This feature provides a [Native ahead-of-time (AOT)](../deploying/native-aot/index.md) and [trim-friendly](../deploying/trimming/trim-self-contained.md) way to use the [configuration binder](configuration.md#binding), without the use of the reflection-based implementation. Reflection requires dynamic code generation, which isn't supported in AOT scenarios.
1212

13-
This feature is possible with the advent of [C# interceptors](/dotnet/csharp/whats-new/csharp-12#interceptors) that were introduced in C# 12. Interceptors allow the compiler to generate source code that intercepts specific calls and substitutes them with generated code.
13+
This feature is possible with the advent of [C# interceptors](../../csharp/whats-new/csharp-12.md#interceptors) that were introduced in C# 12. Interceptors allow the compiler to generate source code that intercepts specific calls and substitutes them with generated code.
1414

1515
## Enable the configuration source generator
1616

@@ -52,7 +52,7 @@ The preceding code:
5252
When the application is built, the configuration source generator intercepts the call to `GetValue<T>` and generates the binding code.
5353

5454
> [!IMPORTANT]
55-
> When the `PublishAot` property is set to `true` (or any other AOT warnings are enabled) and the `EnabledConfigurationBindingGenerator` property is set to `false`, warning `IL2026` is raised. This warning indicates that members are attributed with [RequiresUnreferencedCode](xref:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute) may break when trimming. For more information, see [IL2026](/dotnet/core/deploying/trimming/trim-warnings/il2026).
55+
> When the `PublishAot` property is set to `true` (or any other AOT warnings are enabled) and the `EnabledConfigurationBindingGenerator` property is set to `false`, warning `IL2026` is raised. This warning indicates that members are attributed with [RequiresUnreferencedCode](xref:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute) may break when trimming. For more information, see [IL2026](../deploying/trimming/trim-warnings/il2026.md).
5656
5757
### Explore the source generated code
5858

docs/core/testing/unit-testing-platform-architecture-extensions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ Let's examine the apis and their mean:
854854
* `OneOrMore`: Represents an argument arity of one or more.
855855
* `ExactlyOne`: Represents an argument arity of exactly one.
856856

857-
For examples, refer to the [System.CommandLine arity table](/dotnet/standard/commandline/syntax#argument-arity).
857+
For examples, refer to the [System.CommandLine arity table](../../standard/commandline/syntax.md#argument-arity).
858858

859859
`bool isHidden`: This property signifies that the option is available for use but will not be displayed in the description when `--help` is invoked.
860860

docs/core/whats-new/dotnet-6.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Many improvements have been made in <xref:System.Text.Json?displayProperty=fullN
9494

9595
### Source generator
9696

97-
.NET 6 adds a new [source generator](../../csharp/roslyn-sdk/source-generators-overview.md) for <xref:System.Text.Json?displayProperty=fullName>. Source generation works with <xref:System.Text.Json.JsonSerializer> and can be configured in multiple ways. It can improve performance, reduce memory usage, and facilitate assembly trimming. For more information, see [How to choose reflection or source generation in System.Text.Json](../../standard/serialization/system-text-json/source-generation-modes.md) and [How to use source generation in System.Text.Json](../../standard/serialization/system-text-json/source-generation.md).
97+
.NET 6 adds a new [source generator](../../csharp/roslyn-sdk/index.md#source-generators) for <xref:System.Text.Json?displayProperty=fullName>. Source generation works with <xref:System.Text.Json.JsonSerializer> and can be configured in multiple ways. It can improve performance, reduce memory usage, and facilitate assembly trimming. For more information, see [How to choose reflection or source generation in System.Text.Json](../../standard/serialization/system-text-json/source-generation-modes.md) and [How to use source generation in System.Text.Json](../../standard/serialization/system-text-json/source-generation.md).
9898

9999
### Writeable DOM
100100

docs/csharp/programming-guide/classes-and-structs/partial-classes-and-methods.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ There are several situations when splitting a class definition is desirable:
1717

1818
- Declaring a class over separate files enables multiple programmers to work on it at the same time.
1919
- You can add code to the class without having to recreate the source file that includes automatically generated source. Visual Studio uses this approach when it creates Windows Forms, Web service wrapper code, and so on. You can create code that uses these classes without having to modify the file created by Visual Studio.
20-
- [Source generators](../../roslyn-sdk/source-generators-overview.md) can generate extra functionality in a class.
20+
- [Source generators](../../roslyn-sdk/index.md#source-generators) can generate extra functionality in a class.
2121

2222
To split a class definition, use the [partial](../../language-reference/keywords/partial-type.md) keyword modifier, as shown here:
2323

docs/csharp/roslyn-sdk/index.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
title: The .NET Compiler Platform SDK (Roslyn APIs)
33
description: Learn to use the .NET Compiler Platform SDK (also called the Roslyn APIs) to understand .NET code, spot errors, and fix those errors.
4-
ms.date: 10/10/2017
4+
ms.date: 10/25/2024
55
ms.custom: mvc
66
---
7-
87
# The .NET Compiler Platform SDK
98

109
Compilers build a detailed model of application code as they validate the
@@ -119,6 +118,14 @@ learn accepted practices quickly and become productive earlier in their .NET
119118
journey. As these become more widely used, the community adopts these
120119
practices.
121120

121+
## Source generators
122+
123+
Source generators aim to enable *compile time metaprogramming*, that is, code that can be created
124+
at compile time and added to the compilation. Source generators are able to read the contents of
125+
the compilation before running, as well as access any *additional files*. This ability enables them to
126+
introspect both user C# code and generator-specific files. You can learn how to build incremental
127+
source generators using the [source generator cookbook](https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.cookbook.md).
128+
122129
## Next steps
123130

124131
The .NET Compiler Platform SDK includes the latest language object models
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)