net8.0: upgrade from netcoreapp3.1, fix Linux rendering

- TFM: netcoreapp3.1 → net8.0, netstandard2.1 → net8.0
- System.Drawing.Common 5.0.3 → 6.0.0 (last version with Unix support)
- Remove stale packages (NETStandard.Library, System.Collections)
- Set System.Drawing.EnableUnixSupport via runtimeconfig + AppContext
- Pin System.Resources.Extensions 8.0.0, suppress NU1603
- Copy game_folder assets to build output (no run.sh required)
- Sta.CurrentDirectory → AppContext.BaseDirectory for portable path resolution
- Enable UnsafeBinaryFormatterSerialization + InvariantGlobalization
- Add global.json pinning SDK to 8.x
- Remove ambiguous `using System.Net.Mime.MediaTypeNames` in ParT.cs
- Add `using System.Reflection` to Program.cs
This commit is contained in:
2026-06-13 13:18:28 +02:00
parent dc27a5cf59
commit 636a078c3b
8 changed files with 38 additions and 13 deletions

View File

@@ -3,26 +3,26 @@
<PropertyGroup> <PropertyGroup>
<AssemblyName>2DGAMELIB</AssemblyName> <AssemblyName>2DGAMELIB</AssemblyName>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo> <GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<UseWindowsForms>True</UseWindowsForms> <TargetFramework>net8.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<Platforms>AnyCPU</Platforms>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<LangVersion>9.0</LangVersion> <LangVersion>9.0</LangVersion>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources> <GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
<GenerateResourceWarnOnBinaryFormatterUse>false</GenerateResourceWarnOnBinaryFormatterUse>
<NoWarn>SYSLIB0011;CA1416</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="glfw-net" Version="3.3.1" /> <PackageReference Include="glfw-net" Version="3.3.1" />
<PackageReference Include="NETStandard.Library" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Silk.NET.OpenGL" Version="2.22.0" /> <PackageReference Include="Silk.NET.OpenGL" Version="2.22.0" />
<PackageReference Include="System.Collections" Version="4.3.0" /> <PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.Drawing.Common" Version="5.0.3" /> <PackageReference Include="System.Resources.Extensions" Version="8.0.0">
<PackageReference Include="System.Resources.Extensions" Version="7.0.1" /> <NoWarn>NU1603</NoWarn>
</PackageReference>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -2,7 +2,6 @@ using Newtonsoft.Json;
using System; using System;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using static System.Net.Mime.MediaTypeNames;
namespace _2DGAMELIB namespace _2DGAMELIB
{ {

View File

@@ -2,7 +2,10 @@
"profiles": { "profiles": {
"SlaveMatrix": { "SlaveMatrix": {
"commandName": "Project", "commandName": "Project",
"workingDirectory": "$(SolutionDir)\\game_folder" "workingDirectory": "../game_folder",
"environmentVariables": {
"DOTNET_SYSTEM_GLOBALIZATION_INVARIANT": "true"
}
}, },
"WSL": { "WSL": {
"commandName": "WSL2", "commandName": "WSL2",

View File

@@ -4,7 +4,7 @@
<AssemblyName>SlaveMatrix</AssemblyName> <AssemblyName>SlaveMatrix</AssemblyName>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo> <GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
@@ -14,10 +14,17 @@
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>app.ico</ApplicationIcon> <ApplicationIcon>app.ico</ApplicationIcon>
<RootNamespace /> <RootNamespace />
<InvariantGlobalization>true</InvariantGlobalization>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<NoWarn>CA1416</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\2DGAMELIB\2DGAMELIB.csproj" /> <ProjectReference Include="..\2DGAMELIB\2DGAMELIB.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="..\game_folder\**\*" CopyToOutputDirectory="PreserveNewest" LinkBase="" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Properties\Resources.Designer.cs"> <Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>

View File

@@ -1,15 +1,19 @@
using System; using System;
using System.Reflection;
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix namespace SlaveMatrix
{ {
internal static class Program internal static class Program
{ {
static Program()
{
AppContext.SetSwitch("System.Drawing.EnableUnixSupport", true);
}
[STAThread] [STAThread]
private static void Main(string[] A_0) private static void Main(string[] A_0)
{ {
Sta.LoadConfig(); Sta.LoadConfig();
double percent = 35.0; double percent = 35.0;

View File

@@ -1410,7 +1410,7 @@ namespace SlaveMatrix
B_クロス初期化 = default(B_クロス情報); B_クロス初期化 = default(B_クロス情報);
B_前掛け初期化 = default(B_前掛け情報); B_前掛け初期化 = default(B_前掛け情報);
= default(); = default();
CurrentDirectory = Directory.GetCurrentDirectory(); CurrentDirectory = AppContext.BaseDirectory;
GameData = new GameState(); GameData = new GameState();
SavePath = Path.Combine(CurrentDirectory, "save"); SavePath = Path.Combine(CurrentDirectory, "save");
ImiPath = Path.Combine(CurrentDirectory, "text", "Basement", "Training", "Imitation.txt"); ImiPath = Path.Combine(CurrentDirectory, "text", "Basement", "Training", "Imitation.txt");

View File

@@ -0,0 +1,5 @@
{
"configProperties": {
"System.Drawing.EnableUnixSupport": true
}
}

7
global.json Normal file
View File

@@ -0,0 +1,7 @@
{
"sdk": {
"version": "8.0.0",
"rollForward": "latestMajor",
"allowPrerelease": true
}
}