TShock/TShockLauncher/TShockLauncher.csproj
2026-01-31 20:01:32 +08:00

109 lines
5.3 KiB
XML

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>TShock.Server</AssemblyName> <!-- TShock was initially decided on by a community poll, however tshock already exists as a folder and will clash -->
<RunPostBuildEvent>Always</RunPostBuildEvent>
<DebugType>embedded</DebugType>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract> <!-- needed for sqlite native libs -->
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\TerrariaServerAPI\TerrariaServerAPI\TerrariaServerAPI.csproj" ExcludeFromSingleFile="true" />
<ProjectReference Include="..\TShockAPI\TShockAPI.csproj" ExcludeFromSingleFile="true" ReferenceOutputAssembly="false" /> <!-- allow api to rebuilt with this project, so ServerPlugins are refreshed -->
<ProjectReference Include="..\TShockPluginManager\TShockPluginManager.csproj"/>
<Reference Include="HttpServer" ExcludeFromSingleFile="true">
<HintPath>..\prebuilts\HttpServer.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="..\prebuilts\GeoIP.dat">
<Link>GeoIP.dat</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="MySql.Data" Version="9.1.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" />
<PackageReference Include="Npgsql" Version="9.0.3" />
<PackageReference Include="ModFramework" Version="1.1.15" GeneratePathProperty="true" /> <!-- only used to extract out to ./bin. -->
<PackageReference Include="GetText.NET" Version="8.0.5" /> <!-- only used to extract out to ./bin. -->
<!-- the launcher doesnt need the direct OTAPI reference, but since PackageReference[ExcludeFromSingleFile] doesnt work, exclude the assets and copy manually -->
<PackageReference Include="OTAPI.Upcoming" Version="3.3.4" ExcludeAssets="all" GeneratePathProperty="true" />
<None Include="$(PkgOTAPI_Upcoming)\lib\net9.0\OTAPI.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</None>
<None Include="$(PkgOTAPI_Upcoming)\lib\net9.0\OTAPI.Runtime.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</None>
<None Include="$(PkgModFramework)\lib\net9.0\ModFramework.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</None>
<PackageReference Include="System.IO.Packaging" Version="10.0.2" />
</ItemGroup>
<Target Name="CheckMsgfmtCallable">
<Exec Command="msgfmt --help > NUL" IgnoreExitCode="True" Condition=" '$(OS)' == 'Windows_NT' ">
<Output TaskParameter="ExitCode" PropertyName="MsgfmtExitCode" />
</Exec>
<Exec Command="msgfmt --help 2>/dev/null >/dev/null" IgnoreExitCode="True" Condition=" '$(OS)' != 'Windows_NT' ">
<Output TaskParameter="ExitCode" PropertyName="MsgfmtExitCode" />
</Exec>
</Target>
<!-- The condition for a Target can't come from the values of another target, so instead we have to put the same condition on all three of the items inside. -->
<Target
Name="GenerateMOFiles"
DependsOnTargets="CheckMsgfmtCallable"
AfterTargets="PostBuildEvent;Publish"
Inputs="..\i18n\**\*.po"
Outputs="$(OutDir)i18n\**\*.mo">
<ItemGroup Condition="'$(MsgfmtExitCode)' == '0'">
<POFiles Include="..\i18n\**\*.po" />
</ItemGroup>
<MakeDir Directories="$(OutDir)i18n/%(POFiles.RecursiveDir)" Condition="'$(MsgfmtExitCode)' == '0'" />
<Exec Command="msgfmt -o $(OutDir)i18n/%(RecursiveDir)%(Filename).mo @(POFiles)" Outputs="$(OutDir)i18n\**\*.mo" Condition="'$(MsgfmtExitCode)' == '0'">
<Output ItemName="Generated" TaskParameter="Outputs"/>
</Exec>
</Target>
<Target Name="CreateServerPlugins" AfterTargets="PostBuildEvent;Publish">
<MakeDir Directories="$(OutDir)ServerPlugins" />
<MakeDir Directories="$(PublishDir)ServerPlugins" />
<ItemGroup>
<ApiFiles Include="$(ProjectDir)../TShockAPI/bin/$(Configuration)/$(TargetFramework)/TShockAPI*" />
</ItemGroup>
<Copy SourceFiles="@(ApiFiles)" DestinationFolder="$(OutDir)ServerPlugins" ContinueOnError="true" />
<Copy SourceFiles="@(ApiFiles)" DestinationFolder="$(PublishDir)ServerPlugins" ContinueOnError="true" />
</Target>
<Target Name="CopyI18n" AfterTargets="Publish">
<ItemGroup>
<MOFiles Include="$(OutDir)**/*.mo"/>
</ItemGroup>
<Copy SourceFiles="@(MOFiles)" DestinationFolder="$(PublishDir)%(RecursiveDir)" />
</Target>
<Target Name="MoveDevBin" AfterTargets="PostBuildEvent">
<ItemGroup>
<MoveBinaries Include="$(OutDir)*" Exclude="$(OutDir)\TShock.Server*;$(OutDir)\GeoIP.dat" />
</ItemGroup>
<Move SourceFiles="@(MoveBinaries)" DestinationFolder="$(OutDir)bin" ContinueOnError="true" />
</Target>
<Target Name="MovePublishBin" AfterTargets="Publish">
<ItemGroup>
<MoveBinaries Include="$(PublishDir)*" Exclude="$(PublishDir)\TShock.Server*;$(PublishDir)\GeoIP.dat" />
</ItemGroup>
<Move SourceFiles="@(MoveBinaries)" DestinationFolder="$(PublishDir)bin" ContinueOnError="true" />
</Target>
</Project>