<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<AssemblyName>StarWebApi</AssemblyName>
<RootNamespace>Stardust.Web</RootNamespace>
<AssemblyTitle>Stardust management API</AssemblyTitle>
<Description>Decoupled WebApi backend for the Stardust distributed service platform. Reuses the area controllers and business services of Stardust.Web while exposing JSON endpoints and the MCP endpoint (POST /mcp, via the shared Stardust.Mcp library), without Razor views. The Vue console (Stardust.Web.Vue build output) is embedded into the assembly, so publishing this project alone ships both API and console, with SPA fallback for history-mode routes.</Description>
<Company>新生命开发团队</Company>
<Copyright>©2002-2026 NewLife</Copyright>
<VersionPrefix>3.7</VersionPrefix>
<VersionSuffix>$([System.DateTime]::Now.ToString(`yyyy.MMdd`))</VersionSuffix>
<Version>$(VersionPrefix).$(VersionSuffix)</Version>
<FileVersion>$(Version)</FileVersion>
<AssemblyVersion>$(VersionPrefix).*</AssemblyVersion>
<Deterministic>false</Deterministic>
<OutputPath>..\Bin\WebApi</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<NoWarn>1701;1702;NU5104;NETSDK1138;CS7035;CS4014;CS8632;CS9113</NoWarn>
<!-- 与 Stardust/StarAgent 等主工程一致,用仓库统一的 newlife.snk 强名称签名 -->
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\Doc\newlife.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<!-- 项目数据范围中间件与控制器基类与 Web 共用同一份源码:Compile Include 引用,不复制文件 -->
<ItemGroup>
<Compile Include="..\Stardust.Web\Infrastructure\ProjectScopeMiddleware.cs" Link="Infrastructure\ProjectScopeMiddleware.cs" />
<Compile Include="..\Stardust.Web\Areas\ProjectScopedController.cs" Link="Areas\ProjectScopedController.cs" />
</ItemGroup>
<!-- 与 Web 一致:通过 Compile Include 引用 Stardust.Server 的服务源码,不复制文件 -->
<ItemGroup>
<Compile Include="..\Stardust.Server\Services\ApolloService.cs" Link="Services\ApolloService.cs" />
<Compile Include="..\Stardust.Server\Services\AppDayStatService.cs" Link="Services\AppDayStatService.cs" />
<Compile Include="..\Stardust.Server\Services\AppOnlineService.cs" Link="AppOnlineService.cs" />
<Compile Include="..\Stardust.Server\Services\AppTokenService.cs" Link="Services\AppTokenService.cs" />
<Compile Include="..\Stardust.Server\Services\ConfigService.cs" Link="Services\ConfigService.cs" />
<Compile Include="..\Stardust.Server\Services\FileStorageService.cs" Link="Services\FileStorageService.cs" />
<Compile Include="..\Stardust.Server\Services\MySqlService.cs" Link="Services\MySqlService.cs" />
<Compile Include="..\Stardust.Server\Services\NodeStatService.cs" Link="Services\NodeStatService.cs" />
<Compile Include="..\Stardust.Server\Services\RedisService.cs" Link="Services\RedisService.cs" />
<Compile Include="..\Stardust.Server\Services\TraceItemStatService.cs" Link="Services\TraceItemStatService.cs" />
<Compile Include="..\Stardust.Server\Services\TraceStatService.cs" Link="Services\TraceStatService.cs" />
<Compile Include="..\Stardust.Server\Services\DnsProviderFactory.cs" Link="Services\DnsProviderFactory.cs" />
<Compile Include="..\Stardust.Server\Services\DnsService.cs" Link="Services\DnsService.cs" />
<Compile Include="..\Stardust.Server\Services\NodeWakeService.cs" Link="Services\NodeWakeService.cs" />
<Compile Include="..\Stardust.Server\Setting.cs" Link="Setting.cs" />
<Compile Include="..\Stardust.Server\Localization\StardustLocalization.cs" Link="Localization\StardustLocalization.cs" />
</ItemGroup>
<!-- 纯 API 后端:引用 NuGet 版 NewLife.Cube(API版),不再链接 Stardust.Web 源码 -->
<ItemGroup>
<PackageReference Include="NewLife.IP" Version="2.6.2026.1024" />
<PackageReference Include="NewLife.MySql" Version="1.7.2026.1201" />
<PackageReference Include="NewLife.Redis" Version="7.0.2026.1201" />
<PackageReference Include="NewLife.Remoting.Extensions" Version="4.1.2026.1201" />
<!-- 魔方 WebAPI 核心库,复用其 EntityController/ApiResponse/AuthController 等纯 API 能力。
6.16.2026.1105-beta0348 起皮肤系统支持 /api 回退保护(MapFallback("/api/{**path}",404)),
WebApi 实现 ICubeSkin 托管内嵌控制台前端;稳定版发布后可回切 -->
<PackageReference Include="NewLife.Cube" Version="6.16.2026.1128-beta0715" />
<!-- 魔方 Swagger/Scalar 依赖的 OpenAPI 文档生成(AddCubeSwagger),与 NewLife.Cube 同步升级 -->
<PackageReference Include="NewLife.Cube.Swagger" Version="6.16.2026.1128-beta0715" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Stardust.Data\Stardust.Data.csproj" />
<ProjectReference Include="..\Stardust.Extensions\Stardust.Extensions.csproj" />
<ProjectReference Include="..\Stardust\Stardust.csproj" />
<ProjectReference Include="..\Stardust.Mcp\Stardust.Mcp.csproj" />
</ItemGroup>
<!-- 新控制台前端(Vue SPA):沿用魔方皮肤包 NewLife.Cube.Vue 的 wwwroot 惯例,构建产物放入本工程 wwwroot 后嵌入程序集,
发布本工程得到 DLL 即自带前端,无需额外发布静态文件;运行时由皮肤系统(ICubeSkin 自动发现)托管并回退 index.html。
流程:在 Stardust.Web.Vue 执行 pnpm build:all(= vite build + 同步产物到本目录 wwwroot,已 gitignore),再 dotnet publish 本工程;
产物缺失时不嵌入,纯后端构建(CI)不受影响,皮肤系统检测无 index.html 自动跳过注册。 -->
<ItemGroup Condition="'$(SpaFrontend)' != 'false' And Exists('wwwroot\index.html')">
<EmbeddedResource Include="wwwroot\**\*" Exclude="**\*.map" />
</ItemGroup>
<!-- 发布前校验:SpaFrontend 未显式关闭时,发布必须带上前端产物,避免「以为 DLL 有前端」的静默降级 -->
<Target Name="VerifySpaAssets" BeforeTargets="PrepareForPublish" Condition="'$(SpaFrontend)' != 'false' And !Exists('wwwroot\index.html')">
<Error Text="未找到前端构建产物 Stardust.WebApi/wwwroot/index.html。请先在 Stardust.Web.Vue 目录执行 pnpm build:all 构建并同步前端(产物将嵌入 DLL),或使用 -p:SpaFrontend=false 发布纯 API 后端。" />
</Target>
<!-- wwwroot 仅为编译期嵌入源,不随发布输出(内嵌资源已含全部前端文件;物理副本会以无 no-cache 头遮蔽内嵌入口页,且 DLL 单独升级时物理副本陈旧会反向遮蔽内嵌新版)。
实测 Content Remove/StaticWebAssetsEnabled 均拦不住 Web SDK 对 wwwroot 的发布拷贝,故发布管线结束后直接移除输出目录中的 wwwroot -->
<Target Name="RemoveSpaWwwrootFromPublish" AfterTargets="Publish">
<RemoveDir Directories="$(PublishDir)wwwroot" Condition="'$(PublishDir)' != '' And Exists('$(PublishDir)wwwroot')" />
</Target>
<!-- Program.cs 为顶级语句,隐式 Program 类是 internal 的,集成测试工程需可见才能用 WebApplicationFactory<Program>。
本工程现已与仓库统一用 newlife.snk 强名称签名,故 InternalsVisibleTo 必须带 Key=(friend 程序集 Stardust.WebApiTests 亦签名)。
公钥 blob 与 Cube/NewLife.Cube/NewLife.Cube.csproj 的 InternalsVisibleTo 一致。 -->
<ItemGroup>
<InternalsVisibleTo Include="Stardust.WebApiTests" Key="00240000048000001401000006020000002400005253413100080000010001000d41eb3bdab5c2150958b46c95632b7e4dcb0af77ed8637bd8543875bc2443d01273143bb46655a48a92efa76251adc63ccca6d0e9cef2e0ce93e32b5043bea179a6c710981be4a71703a03e10960643f7df091f499cf60183ef0e4e4e2eebf26e25cea0eebf87c8a6d7f8130c283fc3f747cb90623f0aaa619825e3fcd82f267a0f4bfd26c9f2a6b5a62a6b180b4f6d1d091fce6bd60a9aa9aa5b815b833b44e0f2e58b28a354cb20f52f31bb3b3a7c54f515426537e41f9c20c07e51f9cab8abc311daac19a41bd473a51c7386f014edf1863901a5c29addc89da2f2659c9c1e95affd6997396b9680e317c493e974a813186da277ff9c1d1b30e33cb5a2f6" />
</ItemGroup>
<ItemGroup>
<!-- Locales 目录由 NewLife.Core 源生成器编译期解析;本项目未直接引用 Core 包,显式挂载输入 -->
<AdditionalFiles Include="$(MSBuildProjectDirectory)\Locales\*.yml" />
</ItemGroup>
</Project>
|