NET.Generators.Extensions
1.23.0
dotnet add package NET.Generators.Extensions --version 1.23.0
NuGet\Install-Package NET.Generators.Extensions -Version 1.23.0
<PackageReference Include="NET.Generators.Extensions" Version="1.23.0" />
paket add NET.Generators.Extensions --version 1.23.0
#r "nuget: NET.Generators.Extensions, 1.23.0"
// Install NET.Generators.Extensions as a Cake Addin #addin nuget:?package=NET.Generators.Extensions&version=1.23.0 // Install NET.Generators.Extensions as a Cake Tool #tool nuget:?package=NET.Generators.Extensions&version=1.23.0
H.Generators.Extensions
A set of extensions to simplify the code of generators. In addition to extensions, this library also adds a .props file to automatically add your generation-time dependencies to the NuGet package and Integration tests.
Install
The usage is pretty simple:
<PackageReference Include="H.Generators.Extensions" Version="1.4.2" PrivateAssets="all" />
I want to note that PrivateAssets="all" is required to rule out some issues.
Extensions
AnalyzerConfigOptionsProviderExtensions
options.GetGlobalOption(string name)
options.GetOption(AdditionalText, string name)
options.GetRequiredGlobalOption(string name)
options.GetRequiredOption(AdditionalText, string name)
options.TryRecognizeFramework()
options.RecognizeFramework()
To recognize the framework, you will need to add the following code to your %PackageId%.props:
<Project>
<ItemGroup>
<CompilerVisibleProperty Include="RecognizeFramework_DefineConstants"/>
<CompilerVisibleProperty Include="UseWPF"/>
<CompilerVisibleProperty Include="UseWinUI"/>
<CompilerVisibleProperty Include="UseMaui"/>
</ItemGroup>
<Target Name="CreateDefineConstants" BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun;GenerateMSBuildEditorConfigFileCore">
<PropertyGroup>
<RecognizeFramework_DefineConstants>$(DefineConstants.Replace(';',','))</RecognizeFramework_DefineConstants>
</PropertyGroup>
</Target>
</Project>
SourceProductionContextExtensions
context.ReportException(string id, Exception)
StringExtensions
name.ToPropertyName()
name.ToParameterName()
text.RemoveBlankLinesWhereOnlyWhitespaces()
text.NormalizeLineEndings(string? newLine = null)
fullTypeName.ExtractNamespace()
fullTypeName.ExtractSimpleName()
fullTypeName.WithGlobalPrefix()
EnumerableExtensions
values.Inject()
H.Generators.Tests.Extensions
DictionaryAnalyzerConfigOptions
DictionaryAnalyzerConfigOptionsProvider
MemoryAdditionalText
ImmutableArrayExtensions.NormalizeLocations
Support
You can get answers to your questions in my discord support channel:
https://discord.gg/g8u2t9dKgE
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. |
-
net8.0
- Microsoft.CodeAnalysis.CSharp (>= 4.8.0)
-
net9.0
- Microsoft.CodeAnalysis.CSharp (>= 4.9.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.23.0 | 130 | 5/25/2024 |
⭐ Last 10 features:
Added extensions from DependencyPropertyGenerator.
Updated to net8.0.
Added net8.0 support for ReferenceAssemblies.
Updated Uno version in FrameworkReferenceAssemblies.
Added GeneratorDriverExtensions.
Added net7.0 reference assemblies.
Added SelectAndReportDiagnostics.
Added IncrementalValuesProvider.CollectAsEquatableArray.
Simplified framework detection and exclude dynamic names.
Added new steps extensions.
🐞 Last 10 fixes:
Updated Uno and WinAppSdk versions.
Fixed Avalonia ReferenceAssemblies.
Fixed warnings.
Added ability to add/remove _SystemLibs.
Added missing IncrementalValueProvider SelectAndReportExceptions without cancellation token.
Added IncrementalValueProvider SelectAndReportExceptions.
Added missing useful overloads.
Added IncrementalValuesProviderExtensions.WhereNotNull.
Simplified ImmutableArrayExtensions.
Removed deprecated SourceProductionContextExtensions.AddTextSource.