Files
squad-rain-ops-mini/RainOpsMini.csproj

149 lines
5.4 KiB
XML

<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UseSystemResourceKeys>false</UseSystemResourceKeys>
<!-- 单文件发布配置 -->
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>false</SelfContained>
<PublishReadyToRun>false</PublishReadyToRun>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
<!-- 包含所有内容文件以支持单文件提取 (FRP等) -->
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<!-- 生成 XML 文档 -->
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591;4014</NoWarn>
<!-- 生成嵌入式文件清单 -->
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
<!-- 禁用 CET 兼容性 -->
<CETCompat>false</CETCompat>
<!-- 禁用 CET 相关的编译器检查 -->
<EnableCETCompat>false</EnableCETCompat>
</PropertyGroup>
<!-- 添加运行时配置来禁用 CET -->
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Runtime.CompilerServices.RuntimeFeature.IsCetSupported" Value="false" />
<RuntimeHostConfigurationOption Include="System.Runtime.CompilerServices.RuntimeFeature.IsCetRequired" Value="false" />
<RuntimeHostConfigurationOption Include="System.Runtime.InteropServices.BuiltInComInteropSupport" Value="false" />
<RuntimeHostConfigurationOption Include="System.Runtime.TieredCompilation" Value="false" />
<RuntimeHostConfigurationOption Include="System.Runtime.TieredCompilation.QuickJit" Value="false" />
</ItemGroup>
<!-- 添加编译器常量来禁用CET检查 -->
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DefineConstants>$(DefineConstants);DISABLE_CET</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DefineConstants>$(DefineConstants);DISABLE_CET</DefineConstants>
</PropertyGroup>
<!-- 禁用CET编译器检查 -->
<Target Name="DisableCETCheck" BeforeTargets="CoreCompile">
<PropertyGroup>
<NoWarn>$(NoWarn);CS1701;CS1702;CS1705;CS8019</NoWarn>
</PropertyGroup>
</Target>
<Target Name="UpdateVersion" BeforeTargets="BeforeBuild;GenerateAssemblyInfo">
<Exec Command="powershell -ExecutionPolicy Bypass -File &quot;$(ProjectDir)UpdateVersion.ps1&quot; &quot;$(ProjectDir)\&quot;" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
</Exec>
<PropertyGroup>
<AssemblyVersion>$(Version)</AssemblyVersion>
<FileVersion>$(Version)</FileVersion>
<InformationalVersion>$(Version)</InformationalVersion>
</PropertyGroup>
<Message Text="Building Version: $(Version)" Importance="High" />
</Target>
<ItemGroup>
<Compile Remove="SteamTimeQuery\**" />
<Content Remove="SteamTimeQuery\**" />
<EmbeddedResource Remove="SteamTimeQuery\**" />
<None Remove="SteamTimeQuery\**" />
</ItemGroup>
<ItemGroup>
<!-- 防止历史发布目录中的 json 被当作 Content 复制,导致发布卡在 CopyOutOfDate -->
<Content Remove="publish\**" />
<None Remove="publish\**" />
<EmbeddedResource Remove="publish\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.0" />
<PackageReference Include="NPinyin.Core" Version="3.0.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.172" />
<PackageReference Include="System.Runtime.Caching" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<!-- 将 wwwroot 嵌入 -->
<EmbeddedResource Include="wwwroot\**\*" />
</ItemGroup>
<ItemGroup>
<Folder Include="Helpers\SquadGameLog\" />
<Folder Include="SquadGame\ServerConfig\" />
</ItemGroup>
<ItemGroup>
<Content Include="FRP\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Remove="rcon_config.json" />
<Content Remove="rcon_config_AFT2.json" />
<Content Remove="roles.json" />
<Content Remove="runtimeconfig.template.json" />
<Content Remove="users.json" />
<Content Remove="vip_members.json" />
</ItemGroup>
<ItemGroup>
<None Remove="csc-wrapper.cmd" />
<None Remove="debug.log" />
<None Remove="Directory.Build.props" />
<None Remove="RainOps.db" />
<None Remove="UpdateVersion.ps1" />
</ItemGroup>
<ItemGroup>
<Content Update="FRP\frpc.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="FRP\frpc.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="FRP\frpc_full.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Update="SquadGame\ServerConfig\Admins.cfg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<!-- 确保XML文档包含在单文件发布中 -->
<Target Name="IncludeXmlDocInPublish" BeforeTargets="ComputeFilesToBundle">
<ItemGroup>
<ContentWithTargetPath Include="$(OutputPath)$(AssemblyName).xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>$(AssemblyName).xml</TargetPath>
</ContentWithTargetPath>
</ItemGroup>
</Target>
</Project>