@@ -12,18 +12,21 @@ published: true
1212
13131 . Create a blank solution
14142 . Create a class libary in .Net Standard 2.0. Ex: ` PrivateFieldGenerator.csproj `
15- 3 . Update the ` csproj ` file with below things.
15+ 3 . Update the ` csproj ` file with below things.
16+ 4 .
1617``` xml
1718<LangVersion >latest</LangVersion >
1819<EmitCompilerGeneratedFiles >true</EmitCompilerGeneratedFiles >
1920<CompilerGeneratedFilesOutputPath >Generated</CompilerGeneratedFilesOutputPath >
2021<IsRoslynComponent >true</IsRoslynComponent >
2122<EnforceExtendedAnalyzerRules >true</EnforceExtendedAnalyzerRules >
22- ```
23- 4 . Install ` Microsoft.CodeAnalysis.CSharp ` & ` Microsoft.CodeAnalysis.Analyzers `
24- 5 . Add a class file and name is ` PrivateFieldIncrementalGenerator ` . We will be using the ` IIncrementalGenerator `
25- 6 . Decorate the class with the ` [GeneratorAttribute] `
26- 7 . Implement the class like below
23+ ```
24+
25+ 5 . Install ` Microsoft.CodeAnalysis.CSharp ` & ` Microsoft.CodeAnalysis.Analyzers `
26+ 6 . Add a class file and name is ` PrivateFieldIncrementalGenerator ` . We will be using the ` IIncrementalGenerator `
27+ 7 . Decorate the class with the ` [GeneratorAttribute] `
28+ 8 . Implement the class like below
29+ 9 .
2730``` c#
2831public class PrivateFieldGenerator : IIncrementalGenerator
2932{
@@ -142,7 +145,7 @@ public class PrivateFieldGenerator : IIncrementalGenerator
142145 }
143146}
144147```
145- 8 . Done you are ready with your generator.
148+ 9 . Done you are ready with your generator.
146149
147150#### How to use this generator in your real project.
148151
0 commit comments