GFramework/GFramework.SourceGenerators/GFramework.SourceGenerators.csproj
GwWuYou fc88d908be refactor(build): 优化源代码生成器项目配置
- 移除 GeneratePackageOnBuild 和 IsRoslynComponent 配置项
- 统一设置 IncludeBuildOutput 为 false 以避免运行时库输出
- 更新 Microsoft.CodeAnalysis.Analyzers 版本至 4.14.0
- 为所有项目引用添加 PrivateAssets="all" 属性
- 简化打包配置,只将生成器 DLL 打包到 analyzers 目录
- 添加中文注释说明各配置项的作用和用途
2025-12-27 21:11:42 +08:00

42 lines
1.6 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.GFramework.SourceGenerators</PackageId>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- 这是 Analyzer不是运行时库 -->
<IsRoslynAnalyzer>true</IsRoslynAnalyzer>
<IncludeBuildOutput>false</IncludeBuildOutput>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<!-- 可选:调试生成代码 -->
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
</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"/>
</ItemGroup>
<!-- Generator 编译期引用 Attributes / Common但不打包 -->
<ItemGroup>
<ProjectReference Include="..\GFramework.SourceGenerators.Attributes\GFramework.SourceGenerators.Attributes.csproj"
PrivateAssets="all"/>
<ProjectReference Include="..\GFramework.SourceGenerators.Common\GFramework.SourceGenerators.Common.csproj"
PrivateAssets="all"/>
</ItemGroup>
<!-- ★关键:只把 Generator DLL 放进 analyzers -->
<ItemGroup>
<None Include="$(OutputPath)\$(AssemblyName).dll"
Pack="true"
PackagePath="analyzers/dotnet/cs"
Visible="false"/>
</ItemGroup>
</Project>