GFramework/GFramework.SourceGenerators/GFramework.SourceGenerators.csproj
GeWuYou 796408539e refactor(generators): 优化ContextGetGenerator代码结构并改进异常处理
- 修改GetService方法文档,将返回值描述从"返回null"改为"抛出异常"
- 为GetService方法添加InvalidOperationException异常说明
- 删除冗余的IsExternalInit类文件
- 重构属性匹配逻辑,使用预定义集合进行候选属性名称验证
- 添加辅助方法HasCandidateAttribute、TryGetAttributeSimpleName等提升代码可读性
- 改进集合类型推断逻辑,支持接口类型的遍历匹配
- 更新单元测试以验证完全限定名属性和只读列表类型的支持
- 修正诊断错误位置信息的准确性
2026-03-28 12:54:17 +08:00

68 lines
3.1 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>GeWuYou.$(AssemblyName)</PackageId>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- 这是 Analyzer不是运行时库 -->
<IsRoslynAnalyzer>true</IsRoslynAnalyzer>
<IncludeBuildOutput>false</IncludeBuildOutput>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<!-- 可选:调试生成代码 -->
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
</PropertyGroup>
<!-- Roslyn 依赖,只用于 Generator 自身 -->
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" PrivateAssets="all"/>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="4.14.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<!-- Generator 编译期引用 SourceGenerators.Abstractions / Common / Core.Abstractions但不打包 -->
<ItemGroup>
<ProjectReference Include="..\$(AssemblyName).Abstractions\$(AssemblyName).Abstractions.csproj" PrivateAssets="all"/>
<ProjectReference Include="..\$(AssemblyName).Common\$(AssemblyName).Common.csproj" PrivateAssets="all"/>
</ItemGroup>
<ItemGroup>
<Compile Include="..\GFramework.SourceGenerators.Common\Internals\IsExternalInit.cs"
Link="Internals\IsExternalInit.cs"/>
</ItemGroup>
<!-- ★关键:只把 Generator DLL 放进 analyzers -->
<ItemGroup>
<!-- Generator 本体 -->
<None Include="$(OutputPath)\$(AssemblyName).dll"
Pack="true"
PackagePath="analyzers/dotnet/cs"
Visible="false"/>
<!-- ★ Generator 运行期依赖 -->
<None Include="$(OutputPath)\$(AssemblyName).Abstractions.dll"
Pack="true"
PackagePath="analyzers/dotnet/cs"
Visible="false"/>
<!-- ★ Generator 运行期依赖 -->
<None Include="$(OutputPath)\$(AssemblyName).Common.dll"
Pack="true"
PackagePath="analyzers/dotnet/cs"
Visible="false"/>
</ItemGroup>
<ItemGroup>
<None Include="$(OutputPath)\$(AssemblyName).Abstractions.dll" Pack="true" PackagePath="lib\netstandard2.0" Visible="true"/>
<None Include="$(OutputPath)\$(AssemblyName).Abstractions.xml" Pack="true" PackagePath="lib\netstandard2.0" Visible="true"/>
<None Include="$(OutputPath)\$(AssemblyName).Common.dll" Pack="true" PackagePath="lib\netstandard2.0" Visible="true"/>
<None Include="$(OutputPath)\$(AssemblyName).Common.xml" Pack="true" PackagePath="lib\netstandard2.0" Visible="true"/>
<None Include="GeWuYou.$(AssemblyName).targets" Pack="true" PackagePath="build" Visible="false"/>
</ItemGroup>
</Project>