mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 19:03:29 +08:00
- 实现了 LoggerGenerator 源代码生成器,为标记 LogAttribute 的类自动生成日志字段 - 添加了 LogAttribute 特性,支持配置日志分类、字段名、访问修饰符和静态属性 - 创建了 Diagnostics 静态类,定义 GFLOG001 诊断规则检查 partial 类声明 - 集成 Microsoft.CodeAnalysis 包,启用增量生成器和扩展分析器规则 - 生成的代码包含命名空间、类名和日志字段的完整实现
47 lines
2.2 KiB
XML
47 lines
2.2 KiB
XML
<Project Sdk="Microsoft.NET.Sdk">
|
|
|
|
<PropertyGroup>
|
|
<PackageId>GeWuYou.GFramework.Generator</PackageId>
|
|
<TargetFramework>netstandard2.0</TargetFramework>
|
|
<IsRoslynAnalyzer>true</IsRoslynAnalyzer>
|
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
|
<LangVersion>latest</LangVersion>
|
|
<IsRoslynComponent>true</IsRoslynComponent>
|
|
|
|
<!-- 对 generator 项目要启用扩展规则 -->
|
|
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
|
|
<!-- 不把输出当作运行时库 -->
|
|
<IncludeBuildOutput>false</IncludeBuildOutput>
|
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
|
<!-- 有助于调试生成的代码(可选) -->
|
|
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
|
|
<CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
|
|
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" PrivateAssets="all"/>
|
|
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" PrivateAssets="all"/>
|
|
<PackageReference Include="System.Collections.Immutable" Version="9.0.0"/>
|
|
</ItemGroup>
|
|
|
|
<ItemGroup>
|
|
<!-- Generator 需要引用 Attributes 项目,但不作为运行时依赖 -->
|
|
<ProjectReference Include="..\GFramework.Generator.Attributes\GFramework.Generator.Attributes.csproj"
|
|
PrivateAssets="all"/>
|
|
</ItemGroup>
|
|
|
|
<!-- 将 Generator 和 Attributes DLL 打包为 Analyzer -->
|
|
<ItemGroup>
|
|
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true"
|
|
PackagePath="analyzers/dotnet/cs" Visible="false"/>
|
|
<None Include="$(OutputPath)$(AssemblyName).dll" Pack="true" PackagePath="lib/netstandard2.0"/>
|
|
<None Include="$(OutputPath)\GFramework.Generator.Attributes.dll" Pack="true"
|
|
PackagePath="analyzers/dotnet/cs" Visible="false"/>
|
|
<None Update="README.md">
|
|
<Pack>true</Pack>
|
|
<PackagePath></PackagePath>
|
|
</None>
|
|
</ItemGroup>
|
|
|
|
</Project>
|