Leer en inglés

Compartir a través de


ISourceGenerator.Execute Method

Definition

Overloads

Execute(GeneratorExecutionContext)
Obsolete.

Called to perform source generation. A generator can use the context to add source files via the AddSource(String, SourceText) method.

Execute(SourceGeneratorContext)

Called to perform source generation. A generator can use the context to add source files via the AddSource(String, SourceText) method.

Execute(GeneratorExecutionContext)

Source:
ISourceGenerator.cs
Source:
ISourceGenerator.cs
Source:
ISourceGenerator.cs
Source:
ISourceGenerator.cs
Source:
ISourceGenerator.cs
Source:
ISourceGenerator.cs
Source:
ISourceGenerator.cs
Source:
ISourceGenerator.cs
Source:
ISourceGenerator.cs
Source:
ISourceGenerator.cs
Source:
ISourceGenerator.cs

Caution

ISourceGenerator is deprecated and should not be implemented. Please implement IIncrementalGenerator instead. See https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.md.

Called to perform source generation. A generator can use the context to add source files via the AddSource(String, SourceText) method.

C#
public void Execute(Microsoft.CodeAnalysis.GeneratorExecutionContext context);
C#
[System.Obsolete("ISourceGenerator is deprecated and should not be implemented. Please implement IIncrementalGenerator instead. See https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.md.")]
public void Execute(Microsoft.CodeAnalysis.GeneratorExecutionContext context);

Parameters

Attributes

Remarks

This call represents the main generation step. It is called after a Compilation is created that contains the user written code.

A generator can use the Compilation property to discover information about the users compilation and make decisions on what source to provide.

Applies to

Roslyn 4.13.0 y otras versiones
Producto Versiones (Obsoleto)
Roslyn 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.7.0, 4.8.0, 4.9.2, 3.8.0, 3.9.0, 3.10.0, 3.11.0, 4.0.1, 4.1.0, 4.12.2 (4.13.0)

Execute(SourceGeneratorContext)

Called to perform source generation. A generator can use the context to add source files via the AddSource(String, SourceText) method.

C#
public void Execute(Microsoft.CodeAnalysis.SourceGeneratorContext context);

Parameters

context
SourceGeneratorContext

The SourceGeneratorContext to add source to

Remarks

This call represents the main generation step. It is called after a Compilation is created that contains the user written code.

A generator can use the Compilation property to discover information about the users compilation and make decisions on what source to provide.

Applies to

Roslyn 3.7.0 y Roslyn 3.6.0
Producto Versiones
Roslyn 3.6.0, 3.7.0