refactor(build): 移除打包 Source Generator 的自定义目标

- 删除了用于构建和打包 Source Generator 的 MSBuild 目标
- 简化了项目引用结构
- 移除了与 analyzers 文件夹相关的复制逻辑
- 清理了不必要的项目配置代码
- 优化了 NuGet 包生成流程
- 提高了构建脚本的可维护性
This commit is contained in:
GwWuYou 2025-12-10 11:59:43 +08:00
parent 2b51367042
commit 240f1fd899

View File

@ -44,35 +44,7 @@
<ProjectReference Include="GFramework.Generator\GFramework.Generator.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />
<ProjectReference Include="GFramework.Generator.Attributes\GFramework.Generator.Attributes.csproj"/>
<ProjectReference Include="GFramework.Core\GFramework.Core.csproj"/>
</ItemGroup>
<!-- 打包 Source Generator 到 nupkg 的 analyzers/ -->
<Target Name="BuildGeneratorAndPackAnalyzers" BeforeTargets="Pack">
<!-- 1. 构建 Source Generator 项目 -->
<MSBuild Projects="GFramework.Generator\GFramework.Generator.csproj"
Targets="Build"
Properties="Configuration=$(Configuration)" />
<!-- 2. 找到 Generator DLL -->
<ItemGroup>
<_GeneratorDll Include="GFramework.Generator\bin\$(Configuration)\netstandard2.0\GFramework.Generator.dll" />
</ItemGroup>
<!-- 3. 复制到 obj/.../analyzers/netstandard2.0 -->
<MakeDir Directories="$(IntermediateOutputPath)analyzers\netstandard2.0" />
<Copy SourceFiles="@(_GeneratorDll)"
DestinationFolder="$(IntermediateOutputPath)analyzers\netstandard2.0"
SkipUnchangedFiles="true" />
<!-- 4. 标记为 nupkg 文件 -->
<ItemGroup>
<None Include="$(IntermediateOutputPath)analyzers\netstandard2.0\GFramework.Generator.dll"
Pack="true"
PackagePath="analyzers/netstandard2.0" />
</ItemGroup>
</Target>
</Project>