chore(build): 统一使用 AssemblyName 变量简化项目配置

- 将 PackageId 属性从硬编码名称改为 GeWuYou.$(AssemblyName) 模式
- 更新 GFramework.Godot 项目移除重复的 Product 属性
- 修改源代码生成器项目中的 ProjectReference 路径使用 AssemblyName 变量
- 更新源代码生成器项目中 DLL 文件引用使用 AssemblyName 变量
- 调整 targets 文件引用使用 AssemblyName 变量保持一致性
- 消除项目配置中的硬编码依赖提高维护性
This commit is contained in:
GwWuYou 2025-12-28 14:25:33 +08:00
parent 6b8e1fe66e
commit f2fb8942b7
4 changed files with 14 additions and 15 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>GeWuYou.GFramework.Game</PackageId>
<PackageId>GeWuYou.$(AssemblyName)</PackageId>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>GeWuYou.GFramework.Godot.SourceGenerators</PackageId>
<PackageId>GeWuYou.$(AssemblyName)</PackageId>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- 这是 Analyzer不是运行时库 -->
@ -28,20 +28,20 @@
<!-- Generator 编译期引用 Godot.SourceGenerators.Abstractions / Common但不打包 -->
<ItemGroup>
<ProjectReference Include="..\GFramework.Godot.SourceGenerators.Abstractions\GFramework.Godot.SourceGenerators.Abstractions.csproj" PrivateAssets="all"/>
<ProjectReference Include="..\$(AssemblyName).Abstractions\$(AssemblyName).Abstractions.csproj" PrivateAssets="all"/>
<ProjectReference Include="..\GFramework.SourceGenerators.Common\GFramework.SourceGenerators.Common.csproj" PrivateAssets="all"/>
</ItemGroup>
<!-- ★关键:只把 Generator DLL 放进 analyzers -->
<ItemGroup>
<!-- Generator 本体 -->
<None Include="$(OutputPath)\GFramework.Godot.SourceGenerators.dll"
<None Include="$(OutputPath)\$(AssemblyName).dll"
Pack="true"
PackagePath="analyzers/dotnet/cs"
Visible="false"/>
<!-- ★ Generator 运行期依赖 -->
<None Include="$(OutputPath)\GFramework.Godot.SourceGenerators.Abstractions.dll"
<None Include="$(OutputPath)\$(AssemblyName).Abstractions.dll"
Pack="true"
PackagePath="analyzers/dotnet/cs"
Visible="false"/>
@ -57,6 +57,6 @@
<None Include="$(OutputPath)\GFramework.SourceGenerators.Common.dll" Pack="true" PackagePath="lib\netstandard2.0" Visible="true"/>
<None Include="$(OutputPath)\GFramework.SourceGenerators.Common.xml" Pack="true" PackagePath="lib\netstandard2.0" Visible="true"/>
<!-- 包含targets文件 -->
<None Include="GeWuYou.GFramework.Godot.SourceGenerators.targets" Pack="true" PackagePath="build" Visible="false"/>
<None Include="GeWuYou.$(AssemblyName).targets" Pack="true" PackagePath="build" Visible="false"/>
</ItemGroup>
</Project>

View File

@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>GeWuYou.GFramework.Godot</PackageId>
<Product>GeWuYou.GFramework.Godot</Product>
<PackageId>GeWuYou.$(AssemblyName)</PackageId>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>GeWuYou.GFramework.SourceGenerators</PackageId>
<PackageId>GeWuYou.$(AssemblyName)</PackageId>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- 这是 Analyzer不是运行时库 -->
@ -28,26 +28,26 @@
<!-- Generator 编译期引用 SourceGenerators.Abstractions / Common / Core.Abstractions但不打包 -->
<ItemGroup>
<ProjectReference Include="..\GFramework.SourceGenerators.Abstractions\GFramework.SourceGenerators.Abstractions.csproj" PrivateAssets="all"/>
<ProjectReference Include="..\GFramework.SourceGenerators.Common\GFramework.SourceGenerators.Common.csproj" PrivateAssets="all"/>
<ProjectReference Include="..\$(AssemblyName).Abstractions\$(AssemblyName).Abstractions.csproj" PrivateAssets="all"/>
<ProjectReference Include="..\$(AssemblyName).Common\$(AssemblyName).Common.csproj" PrivateAssets="all"/>
<ProjectReference Include="..\GFramework.Core.Abstractions\GFramework.Core.Abstractions.csproj" PrivateAssets="all"/>
</ItemGroup>
<!-- ★关键:只把 Generator DLL 放进 analyzers -->
<ItemGroup>
<!-- Generator 本体 -->
<None Include="$(OutputPath)\GFramework.SourceGenerators.dll"
<None Include="$(OutputPath)\$(AssemblyName).dll"
Pack="true"
PackagePath="analyzers/dotnet/cs"
Visible="false"/>
<!-- ★ Generator 运行期依赖 -->
<None Include="$(OutputPath)\GFramework.SourceGenerators.Abstractions.dll"
<None Include="$(OutputPath)\$(AssemblyName).Abstractions.dll"
Pack="true"
PackagePath="analyzers/dotnet/cs"
Visible="false"/>
<!-- ★ Generator 运行期依赖 -->
<None Include="$(OutputPath)\GFramework.SourceGenerators.Common.dll"
<None Include="$(OutputPath)\$(AssemblyName).Common.dll"
Pack="true"
PackagePath="analyzers/dotnet/cs"
Visible="false"/>
@ -58,6 +58,6 @@
<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.GFramework.SourceGenerators.targets" Pack="true" PackagePath="build" Visible="false"/>
<None Include="GeWuYou.$(AssemblyName).targets" Pack="true" PackagePath="build" Visible="false"/>
</ItemGroup>
</Project>