File tree Expand file tree Collapse file tree 3 files changed +54
-4
lines changed
Expand file tree Collapse file tree 3 files changed +54
-4
lines changed Original file line number Diff line number Diff line change 1- # SourceGeneratorContext
1+ # Datacute Source Generator Context
22A source generator to help creators of source generators, by creating doc-comments showing the available generation context.
3+
4+ # Audience
5+
6+ This source generator is intended for developers creating source generators,
7+ who want to understand the context available to them during the generation process.
8+
9+ # Installation
10+
11+ Add the NuGet package ` Datacute.SourceGeneratorContext `
12+
13+ The package includes both the source generator and a marker attribute dll.
14+ The marker attribute is used to indicate whereabouts in your project that the
15+ source generator context should be generated.
16+
17+ The marker attribute does not need to be included in your project's output assembly,
18+ so the package reference in you ` .csproj ` file can be marked as ` PrivateAssets="all" ExcludeAssets="runtime" ` as follows:
19+
20+ ``` xml
21+ <ItemGroup >
22+ <PackageReference Include =" Datacute.SourceGeneratorContext" Version =" 1.0.0"
23+ PrivateAssets =" all" ExcludeAssets =" runtime" />
24+ </ItemGroup >
25+ ```
26+
27+ # Usage
28+
29+ To use the source generator, create a partial class in your project and decorate it with the ` [SourceGeneratorContext] ` attribute.
30+
31+ ``` csharp
32+ using Datacute .SourceGeneratorContext ;
33+
34+ [SourceGeneratorContext ]
35+ public partial class MySourceGeneratorContext
36+ {
37+ // This class will be populated with doc-comments showing the available context for source generation.
38+ }
39+ ```
40+
41+ Many more examples of the flags available to the attribute can be found in the example project on GitHub:
42+
43+ https://github.com/datacute/SourceGeneratorContext/blob/main/SourceGeneratorContextExample/Program.cs
44+
45+ ---
46+ <small >
47+ <small >
48+ <small >
49+
50+ ###### Datacute - Acute Information Revelation Tools
51+
52+ </small >
53+ </small >
54+ </small >
Original file line number Diff line number Diff line change 6161 </ItemGroup >
6262
6363 <ItemGroup >
64- <!-- Pack the attributes dll in the analyzers/dotnet/cs path -->
65- <None Include =" ..\SourceGeneratorContext.Attribute\bin\$(Configuration)\netstandard2.0\Datacute.SourceGeneratorContext.Attribute.dll" Pack =" true" PackagePath =" analyzers/dotnet/cs" Visible =" false" />
6664 <!-- Explicitly pack the main DLL as an analyzer -->
6765 <None Include =" $(TargetDir)$(TargetFileName)" Pack =" true" PackagePath =" analyzers/dotnet/cs" Visible =" false" />
6866 </ItemGroup >
Original file line number Diff line number Diff line change 11<Project >
22 <PropertyGroup >
33 <VersionPrefix >0.0.2</VersionPrefix >
4- <VersionSuffix >alpha </VersionSuffix >
4+ <VersionSuffix >dev-$([System.DateTime]::UtcNow.ToString("yyyyMMdd-HHmmss")) </VersionSuffix >
55 </PropertyGroup >
66</Project >
You can’t perform that action at this time.
0 commit comments