From 614765a8f6afc4eb33a71160af0dcfc003dd1e20 Mon Sep 17 00:00:00 2001 From: hazre Date: Tue, 15 Sep 2026 23:59:21 +0200 Subject: [PATCH 1/5] chore: strip Unity-only downloads and packaging from build Signed-off-by: hazre --- build/Program.cs | 306 +++++++++++++---------------------------------- 1 file changed, 84 insertions(+), 222 deletions(-) diff --git a/build/Program.cs b/build/Program.cs index c546212f..d4e4fb08 100644 --- a/build/Program.cs +++ b/build/Program.cs @@ -5,7 +5,6 @@ using System.IO; using System.Linq; using System.Runtime.Versioning; -using System.Text; using Cake.Common; using Cake.Common.IO; using Cake.Common.Tools.DotNet; @@ -40,24 +39,10 @@ public enum ProjectBuildType BleedingEdge } - public const string DOORSTOP_VERSION = "4.3.0"; - public const string DOTNET_RUNTIME_VERSION = "6.0.7"; - public const string DOBBY_VERSION = "1.0.5"; public const string HOOKFXR_VERSION = "1.1.0"; - public const string DOTNET_RUNTIME_ZIP_URL = - $"https://github.com/BepInEx/dotnet-runtime/releases/download/{DOTNET_RUNTIME_VERSION}/mini-coreclr-Release.zip"; internal readonly DistributionTarget[] Distributions = { - //new("Unity.Mono", "win-x86"), - //new("Unity.Mono", "win-x64"), - //new("Unity.Mono", "linux-x86"), - //new("Unity.Mono", "linux-x64"), - //new("Unity.Mono", "macos-x64"), - //new("Unity.IL2CPP", "win-x86"), - //new("Unity.IL2CPP", "win-x64"), - //new("Unity.IL2CPP", "linux-x64"), - //new("Unity.IL2CPP", "macos-x64"), //new("NET.Framework", "win-x86", "net40"), //new("NET.Framework", "win-x86", "net452"), //new("NET.CoreCLR", "win-x64", "netcoreapp3.1"), @@ -115,12 +100,6 @@ public BuildContext(ICakeContext ctx) var _ => $"-{VersionSuffix}+{this.GitShortenSha(RootDirectory, CurrentCommit)}", }; - public static string DoorstopZipUrl(string arch) => - $"https://github.com/NeighTools/UnityDoorstop/releases/download/v{DOORSTOP_VERSION}/doorstop_{arch}_release_{DOORSTOP_VERSION}.zip"; - - public static string DobbyZipUrl(string arch) => - $"https://github.com/BepInEx/Dobby/releases/download/v{DOBBY_VERSION}/dobby-{arch}.zip"; - public static string HookfxrZipUrl = $"https://github.com/ResoniteModding/hookfxr/releases/download/v{HOOKFXR_VERSION}/hookfxr-Release.zip"; } @@ -242,44 +221,6 @@ public override void Run(BuildContext ctx) var cache = new DependencyCache(ctx, ctx.CacheDirectory.CombineWithFilePath("cache.json")); - cache.Refresh("NeighTools/UnityDoorstop", BuildContext.DOORSTOP_VERSION, () => - { - ctx.Log.Information($"Downloading Doorstop {BuildContext.DOORSTOP_VERSION}"); - var doorstopDir = ctx.CacheDirectory.Combine("doorstop"); - ctx.CreateDirectory(doorstopDir); - ctx.CleanDirectory(doorstopDir); - var archs = new[] { "win", "linux", "macos" }; - var versions = archs - .Select(a => ($"Doorstop ({a})", - BuildContext.DoorstopZipUrl(a), - doorstopDir.Combine($"doorstop_{a}"))) - .ToArray(); - ctx.DownloadZipFiles($"Doorstop {BuildContext.DOORSTOP_VERSION}", versions); - }); - - cache.Refresh("BepInEx/Dobby", BuildContext.DOBBY_VERSION, () => - { - ctx.Log.Information($"Downloading Dobby {BuildContext.DOBBY_VERSION}"); - var dobbyDir = ctx.CacheDirectory.Combine("dobby"); - ctx.CreateDirectory(dobbyDir); - ctx.CleanDirectory(dobbyDir); - var archs = new[] { "win", "linux", "macos" }; - var versions = archs - .Select(a => ($"Dobby ({a})", BuildContext.DobbyZipUrl(a), dobbyDir.Combine($"dobby_{a}"))) - .ToArray(); - ctx.DownloadZipFiles($"Dobby {BuildContext.DOBBY_VERSION}", versions); - }); - - cache.Refresh("BepInEx/dotnet_runtime", BuildContext.DOTNET_RUNTIME_VERSION, () => - { - ctx.Log.Information($"Downloading dotnet runtime {BuildContext.DOTNET_RUNTIME_VERSION}"); - var dotnetDir = ctx.CacheDirectory.Combine("dotnet"); - ctx.CreateDirectory(dotnetDir); - ctx.CleanDirectory(dotnetDir); - ctx.DownloadZipFiles($"dotnet-runtime {BuildContext.DOTNET_RUNTIME_VERSION}", - ("dotnet runtime", BuildContext.DOTNET_RUNTIME_ZIP_URL, dotnetDir)); - }); - cache.Refresh("ResoniteModding/hookfxr", BuildContext.HOOKFXR_VERSION, () => { ctx.Log.Information($"Downloading hookfxr {BuildContext.HOOKFXR_VERSION}"); @@ -304,18 +245,6 @@ public override void Run(BuildContext ctx) ctx.CreateDirectory(ctx.DistributionDirectory); ctx.CleanDirectory(ctx.DistributionDirectory); - var latestTag = ctx.Git("describe --tags --abbrev=0"); - var changelog = new StringBuilder() - .AppendLine( - $"{ctx.Git($"rev-list --count {latestTag}..HEAD")} changes since {latestTag}") - .AppendLine() - .AppendLine("Changelog (excluding merge commits):") - .AppendLine(ctx.Git( - $"--no-pager log --no-merges --pretty=\"format:* (%h) [%an] %s\" {latestTag}..HEAD", - Environment.NewLine)) - .ToString(); - - foreach (var dist in ctx.Distributions) { ctx.Log.Information($"Creating distribution {dist.Target}"); @@ -326,192 +255,125 @@ public override void Run(BuildContext ctx) var bepInExDir = targetDir.Combine("BepInEx"); var bepInExCoreDir = bepInExDir.Combine("core"); - // Only create BepInEx directories for non-BepisLoader distributions - if (dist.Runtime != "BepisLoader") - { - ctx.CreateDirectory(bepInExDir); - ctx.CreateDirectory(bepInExCoreDir); - ctx.CreateDirectory(bepInExDir.Combine("plugins")); - ctx.CreateDirectory(bepInExDir.Combine("patchers")); - } - var sourceDirectory = ctx.OutputDirectory.Combine(dist.DistributionIdentifier); if (dist.FrameworkTarget != null) sourceDirectory = sourceDirectory.Combine(dist.FrameworkTarget); - if (dist.Runtime != "BepisLoader") + if (dist.Runtime == "BepisLoader") { - File.WriteAllText(targetDir.CombineWithFilePath("changelog.txt").FullPath, changelog); - - foreach (var filePath in ctx.GetFiles(sourceDirectory.Combine("*.*").FullPath)) + foreach (var filePath in ctx.GetFiles(sourceDirectory.Combine("BepisLoader.*").FullPath)) { var fileName = filePath.GetFilename().FullPath.ToLower(); - // Skip XML documentation files if (!fileName.EndsWith(".xml")) { - ctx.CopyFileToDirectory(filePath, bepInExCoreDir); + ctx.CopyFileToDirectory(filePath, targetDir); } } - } - if (dist.Engine == "Unity") - { - var doorstopPath = dist.Os == "macos" - ? ctx.CacheDirectory.Combine("doorstop").Combine("doorstop_macos").Combine("universal") - : ctx.CacheDirectory.Combine("doorstop").Combine($"doorstop_{dist.Os}").Combine(dist.Arch); - foreach (var filePath in ctx.GetFiles(doorstopPath.Combine($"*.{dist.DllExtension}").FullPath)) - ctx.CopyFileToDirectory(filePath, targetDir); - ctx.CopyFileToDirectory(doorstopPath.CombineWithFilePath(".doorstop_version"), targetDir); - var (doorstopConfigFile, doorstopConfigDistName) = dist.Os switch + // Copy LinuxBootstrap.sh from BepisLoader project directory + var linuxBootstrapPath = ctx.RootDirectory.CombineWithFilePath("Runtimes/NET/BepisLoader/LinuxBootstrap.sh"); + if (ctx.FileExists(linuxBootstrapPath)) { - "win" => ($"doorstop_config_{dist.Runtime.ToLower()}.ini", - "doorstop_config.ini"), - "linux" or "macos" => ($"run_bepinex_{dist.Runtime.ToLower()}.sh", - "run_bepinex.sh"), - var _ => throw new - NotSupportedException( - $"Doorstop is not supported on {dist.Os}") - }; - ctx.CopyFile(ctx.RootDirectory.Combine("Runtimes").Combine("Unity").Combine("Doorstop").CombineWithFilePath(doorstopConfigFile), - targetDir.CombineWithFilePath(doorstopConfigDistName)); - - if (dist.Runtime == "IL2CPP") + ctx.CopyFileToDirectory(linuxBootstrapPath, targetDir); + ctx.Log.Information("Copied LinuxBootstrap.sh to distribution"); + } + else { - ctx.CopyFile(ctx.CacheDirectory.Combine("dobby").Combine($"dobby_{dist.Os}").CombineWithFilePath($"{dist.DllPrefix}dobby_{dist.Arch}.{dist.DllExtension}"), - bepInExCoreDir.CombineWithFilePath($"{dist.DllPrefix}dobby.{dist.DllExtension}")); - ctx.CopyDirectory(ctx.CacheDirectory.Combine("dotnet").Combine(dist.RuntimeIdentifier), - targetDir.Combine("dotnet")); + ctx.Log.Warning("LinuxBootstrap.sh not found at: " + linuxBootstrapPath); } - } - else if (dist.Engine == "NET") - { - if (dist.Runtime == "Framework") + + var netCoreCLRSource = ctx.OutputDirectory.Combine("NET.CoreCLR").Combine("net10.0"); + if (ctx.DirectoryExists(netCoreCLRSource)) { - ctx.DeleteFile(bepInExCoreDir.CombineWithFilePath("BepInEx.NET.Framework.Launcher.exe.config")); + // Create BepInEx directories only if we have files to copy + ctx.CreateDirectory(bepInExDir); + ctx.CreateDirectory(bepInExCoreDir); - ctx.MoveFileToDirectory(bepInExCoreDir.CombineWithFilePath("BepInEx.NET.Framework.Launcher.exe"), targetDir); + foreach (var filePath in ctx.GetFiles(netCoreCLRSource.Combine("*.*").FullPath)) + { + var fileName = filePath.GetFilename().FullPath.ToLower(); + ctx.CopyFileToDirectory(filePath, bepInExCoreDir); + } } - else if (dist.Runtime == "CoreCLR") + else { - foreach (var filePath in ctx.GetFiles(bepInExCoreDir.Combine("BepInEx.NET.CoreCLR.*").FullPath)) - ctx.MoveFileToDirectory(filePath, targetDir); + ctx.Log.Warning($"NET.CoreCLR output directory not found: {netCoreCLRSource}"); + ctx.Log.Warning("Make sure to build NET.CoreCLR target first if you want BepInEx support"); } - else if (dist.Runtime == "BepisLoader") + + // Copy hookfxr files to root directory (excluding readme files and pdb files) + var hookfxrPath = ctx.CacheDirectory.Combine("hookfxr"); + if (ctx.DirectoryExists(hookfxrPath)) { - foreach (var filePath in ctx.GetFiles(sourceDirectory.Combine("BepisLoader.*").FullPath)) + foreach (var filePath in ctx.GetFiles(hookfxrPath.Combine("*.*").FullPath)) { var fileName = filePath.GetFilename().FullPath.ToLower(); - if (!fileName.EndsWith(".xml")) + if (!fileName.EndsWith(".md") && !fileName.EndsWith(".pdb")) { ctx.CopyFileToDirectory(filePath, targetDir); } } - // Copy LinuxBootstrap.sh from BepisLoader project directory - var linuxBootstrapPath = ctx.RootDirectory.CombineWithFilePath("Runtimes/NET/BepisLoader/LinuxBootstrap.sh"); - if (ctx.FileExists(linuxBootstrapPath)) - { - ctx.CopyFileToDirectory(linuxBootstrapPath, targetDir); - ctx.Log.Information("Copied LinuxBootstrap.sh to distribution"); - } - else - { - ctx.Log.Warning("LinuxBootstrap.sh not found at: " + linuxBootstrapPath); - } - - var netCoreCLRSource = ctx.OutputDirectory.Combine("NET.CoreCLR").Combine("net10.0"); - if (ctx.DirectoryExists(netCoreCLRSource)) + // Update hookfxr.ini to target BepisLoader.dll + var hookfxrIniPath = targetDir.CombineWithFilePath("hookfxr.ini"); + if (ctx.FileExists(hookfxrIniPath)) { - // Create BepInEx directories only if we have files to copy - ctx.CreateDirectory(bepInExDir); - ctx.CreateDirectory(bepInExCoreDir); - - foreach (var filePath in ctx.GetFiles(netCoreCLRSource.Combine("*.*").FullPath)) - { - var fileName = filePath.GetFilename().FullPath.ToLower(); - ctx.CopyFileToDirectory(filePath, bepInExCoreDir); - } + var iniContent = System.IO.File.ReadAllText(hookfxrIniPath.FullPath); + iniContent = iniContent.Replace("enable=true", "enable=false"); + iniContent = iniContent.Replace("target_assembly=MyApplication.dll", "target_assembly=BepisLoader.dll"); + iniContent = iniContent.Replace("merge_deps_json=true", "merge_deps_json=false"); + System.IO.File.WriteAllText(hookfxrIniPath.FullPath, iniContent); + ctx.Log.Information("Updated hookfxr.ini to target BepisLoader.dll"); } - else - { - ctx.Log.Warning($"NET.CoreCLR output directory not found: {netCoreCLRSource}"); - ctx.Log.Warning("Make sure to build NET.CoreCLR target first if you want BepInEx support"); - } - - // Copy hookfxr files to root directory (excluding readme files and pdb files) - var hookfxrPath = ctx.CacheDirectory.Combine("hookfxr"); - if (ctx.DirectoryExists(hookfxrPath)) - { - foreach (var filePath in ctx.GetFiles(hookfxrPath.Combine("*.*").FullPath)) - { - var fileName = filePath.GetFilename().FullPath.ToLower(); - if (!fileName.EndsWith(".md") && !fileName.EndsWith(".pdb")) - { - ctx.CopyFileToDirectory(filePath, targetDir); - } - } + } + else + { + ctx.Log.Warning($"hookfxr cache directory not found: {hookfxrPath}"); + } - // Update hookfxr.ini to target BepisLoader.dll - var hookfxrIniPath = targetDir.CombineWithFilePath("hookfxr.ini"); - if (ctx.FileExists(hookfxrIniPath)) + // Replace contents of BepisLoader.runtimeconfig.json with the proper framework configuration for windows + var runtimeConfigPath = targetDir.CombineWithFilePath("BepisLoader.runtimeconfig.json"); + if (ctx.FileExists(runtimeConfigPath)) + { + var runtimeConfig = """ { - var iniContent = System.IO.File.ReadAllText(hookfxrIniPath.FullPath); - iniContent = iniContent.Replace("enable=true", "enable=false"); - iniContent = iniContent.Replace("target_assembly=MyApplication.dll", "target_assembly=BepisLoader.dll"); - iniContent = iniContent.Replace("merge_deps_json=true", "merge_deps_json=false"); - System.IO.File.WriteAllText(hookfxrIniPath.FullPath, iniContent); - ctx.Log.Information("Updated hookfxr.ini to target BepisLoader.dll"); - } - } - else - { - ctx.Log.Warning($"hookfxr cache directory not found: {hookfxrPath}"); - } - - // Replace contents of BepisLoader.runtimeconfig.json with the proper framework configuration for windows - var runtimeConfigPath = targetDir.CombineWithFilePath("BepisLoader.runtimeconfig.json"); - if (ctx.FileExists(runtimeConfigPath)) - { - var runtimeConfig = """ - { - "runtimeOptions": { - "tfm": "net10.0", - "frameworks": [ - { - "name": "Microsoft.NETCore.App", - "version": "10.0.0" - }, - { - "name": "Microsoft.WindowsDesktop.App", - "version": "10.0.0" - } - ], - "configProperties": { - "System.Reflection.Metadata.MetadataUpdater.IsSupported": false, - "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false - } + "runtimeOptions": { + "tfm": "net10.0", + "frameworks": [ + { + "name": "Microsoft.NETCore.App", + "version": "10.0.0" + }, + { + "name": "Microsoft.WindowsDesktop.App", + "version": "10.0.0" } + ], + "configProperties": { + "System.Reflection.Metadata.MetadataUpdater.IsSupported": false, + "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false } - """; - System.IO.File.WriteAllText(runtimeConfigPath.FullPath, runtimeConfig); - ctx.Log.Information("Updated BepisLoader.runtimeconfig.json with proper framework configuration"); - } - else - { - ctx.Log.Warning($"BepisLoader.runtimeconfig.json not found at: {runtimeConfigPath}"); - } + } + } + """; + System.IO.File.WriteAllText(runtimeConfigPath.FullPath, runtimeConfig); + ctx.Log.Information("Updated BepisLoader.runtimeconfig.json with proper framework configuration"); + } + else + { + ctx.Log.Warning($"BepisLoader.runtimeconfig.json not found at: {runtimeConfigPath}"); + } - // Copy icon.ico from BepisLoader project directory to BepInEx folder - var iconPath = ctx.RootDirectory.CombineWithFilePath("Runtimes/NET/BepisLoader/icon.ico"); - if (ctx.FileExists(iconPath)) - { - ctx.CopyFileToDirectory(iconPath, bepInExDir); - ctx.Log.Information("Copied icon.ico to BepInEx folder"); - } - else - { - ctx.Log.Warning("icon.ico not found at: " + iconPath); - } + // Copy icon.ico from BepisLoader project directory to BepInEx folder + var iconPath = ctx.RootDirectory.CombineWithFilePath("Runtimes/NET/BepisLoader/icon.ico"); + if (ctx.FileExists(iconPath)) + { + ctx.CopyFileToDirectory(iconPath, bepInExDir); + ctx.Log.Information("Copied icon.ico to BepInEx folder"); + } + else + { + ctx.Log.Warning("icon.ico not found at: " + iconPath); } } } From e46a45ad9388c69d3087dc716281024cc0a1defa Mon Sep 17 00:00:00 2001 From: hazre Date: Wed, 16 Sep 2026 00:17:52 +0200 Subject: [PATCH 2/5] chore: convert solution to slnx and trim Harmony to netstandard2.0 Signed-off-by: hazre --- BepInEx.Core/BepInEx.Core.csproj | 2 +- .../BepInEx.Preloader.Core.csproj | 2 +- BepInEx.sln | 119 ------------------ BepInEx.slnx | 24 ++++ .../BepInEx.NET.Common.csproj | 2 +- 5 files changed, 27 insertions(+), 122 deletions(-) delete mode 100644 BepInEx.sln create mode 100644 BepInEx.slnx diff --git a/BepInEx.Core/BepInEx.Core.csproj b/BepInEx.Core/BepInEx.Core.csproj index 72f0e5bb..99de45fe 100644 --- a/BepInEx.Core/BepInEx.Core.csproj +++ b/BepInEx.Core/BepInEx.Core.csproj @@ -7,7 +7,7 @@ true - + diff --git a/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj b/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj index 3aecf63d..5fe45f04 100644 --- a/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj +++ b/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj @@ -5,7 +5,7 @@ - + diff --git a/BepInEx.sln b/BepInEx.sln deleted file mode 100644 index fcc2bcee..00000000 --- a/BepInEx.sln +++ /dev/null @@ -1,119 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.32112.339 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.Preloader.Core", "BepInEx.Preloader.Core\BepInEx.Preloader.Core.csproj", "{15F8BC38-A761-4F93-8903-1B531AC5D9F9}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.Core", "BepInEx.Core\BepInEx.Core.csproj", "{4FFBA620-F5ED-47F9-B90C-DAD1316FD9B9}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NET", "NET", "{6EC98884-A3DC-4828-85EF-5F10F7519429}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Markdown", "Markdown", "{68C57430-3E92-4B50-A9A5-208FE9CCD914}" - ProjectSection(SolutionItems) = preProject - README.md = README.md - EndProjectSection -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.NET.Common", "Runtimes\NET\BepInEx.NET.Common\BepInEx.NET.Common.csproj", "{76EB1952-7826-471C-9CF3-815D094DA077}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.NET.CoreCLR", "Runtimes\NET\BepInEx.NET.CoreCLR\BepInEx.NET.CoreCLR.csproj", "{08083F40-98AA-4176-BA01-817C18C35C7F}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "BepInEx.NET.Shared", "Runtimes\NET\BepInEx.NET.Shared\BepInEx.NET.Shared.shproj", "{067BCC8C-FC25-4929-B4F4-C6A5A7496994}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{12081C35-76DF-450C-AC83-1E1CB84516AA}" - ProjectSection(SolutionItems) = preProject - Directory.Build.props = Directory.Build.props - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "build\Build.csproj", "{0C38DDF2-EAAA-43FA-BA0A-985636AC6040}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BepisLoader", "Runtimes\NET\BepisLoader\BepisLoader.csproj", "{0C729EA7-A634-AFFF-6D19-20C29787045C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HarmonyX", "HarmonyX", "{3BC3CB3F-C3A1-BACA-1E5E-17DD6508E989}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Harmony", "HarmonyX\Harmony\Harmony.csproj", "{8795B562-8178-4563-BA43-4157E9FED8D2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release_NetFramework|Any CPU = Release_NetFramework|Any CPU - Release_Unity|Any CPU = Release_Unity|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {15F8BC38-A761-4F93-8903-1B531AC5D9F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {15F8BC38-A761-4F93-8903-1B531AC5D9F9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {15F8BC38-A761-4F93-8903-1B531AC5D9F9}.Release_NetFramework|Any CPU.ActiveCfg = Release|Any CPU - {15F8BC38-A761-4F93-8903-1B531AC5D9F9}.Release_NetFramework|Any CPU.Build.0 = Release|Any CPU - {15F8BC38-A761-4F93-8903-1B531AC5D9F9}.Release_Unity|Any CPU.ActiveCfg = Release|Any CPU - {15F8BC38-A761-4F93-8903-1B531AC5D9F9}.Release_Unity|Any CPU.Build.0 = Release|Any CPU - {15F8BC38-A761-4F93-8903-1B531AC5D9F9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {15F8BC38-A761-4F93-8903-1B531AC5D9F9}.Release|Any CPU.Build.0 = Release|Any CPU - {4FFBA620-F5ED-47F9-B90C-DAD1316FD9B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4FFBA620-F5ED-47F9-B90C-DAD1316FD9B9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4FFBA620-F5ED-47F9-B90C-DAD1316FD9B9}.Release_NetFramework|Any CPU.ActiveCfg = Release|Any CPU - {4FFBA620-F5ED-47F9-B90C-DAD1316FD9B9}.Release_NetFramework|Any CPU.Build.0 = Release|Any CPU - {4FFBA620-F5ED-47F9-B90C-DAD1316FD9B9}.Release_Unity|Any CPU.ActiveCfg = Release|Any CPU - {4FFBA620-F5ED-47F9-B90C-DAD1316FD9B9}.Release_Unity|Any CPU.Build.0 = Release|Any CPU - {4FFBA620-F5ED-47F9-B90C-DAD1316FD9B9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4FFBA620-F5ED-47F9-B90C-DAD1316FD9B9}.Release|Any CPU.Build.0 = Release|Any CPU - {76EB1952-7826-471C-9CF3-815D094DA077}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {76EB1952-7826-471C-9CF3-815D094DA077}.Debug|Any CPU.Build.0 = Debug|Any CPU - {76EB1952-7826-471C-9CF3-815D094DA077}.Release_NetFramework|Any CPU.ActiveCfg = Release|Any CPU - {76EB1952-7826-471C-9CF3-815D094DA077}.Release_NetFramework|Any CPU.Build.0 = Release|Any CPU - {76EB1952-7826-471C-9CF3-815D094DA077}.Release_Unity|Any CPU.ActiveCfg = Release|Any CPU - {76EB1952-7826-471C-9CF3-815D094DA077}.Release_Unity|Any CPU.Build.0 = Release|Any CPU - {76EB1952-7826-471C-9CF3-815D094DA077}.Release|Any CPU.ActiveCfg = Release|Any CPU - {76EB1952-7826-471C-9CF3-815D094DA077}.Release|Any CPU.Build.0 = Release|Any CPU - {08083F40-98AA-4176-BA01-817C18C35C7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {08083F40-98AA-4176-BA01-817C18C35C7F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {08083F40-98AA-4176-BA01-817C18C35C7F}.Release_NetFramework|Any CPU.ActiveCfg = Release|Any CPU - {08083F40-98AA-4176-BA01-817C18C35C7F}.Release_NetFramework|Any CPU.Build.0 = Release|Any CPU - {08083F40-98AA-4176-BA01-817C18C35C7F}.Release_Unity|Any CPU.ActiveCfg = Release|Any CPU - {08083F40-98AA-4176-BA01-817C18C35C7F}.Release_Unity|Any CPU.Build.0 = Release|Any CPU - {08083F40-98AA-4176-BA01-817C18C35C7F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {08083F40-98AA-4176-BA01-817C18C35C7F}.Release|Any CPU.Build.0 = Release|Any CPU - {0C38DDF2-EAAA-43FA-BA0A-985636AC6040}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C38DDF2-EAAA-43FA-BA0A-985636AC6040}.Release_NetFramework|Any CPU.ActiveCfg = Debug|Any CPU - {0C38DDF2-EAAA-43FA-BA0A-985636AC6040}.Release_NetFramework|Any CPU.Build.0 = Debug|Any CPU - {0C38DDF2-EAAA-43FA-BA0A-985636AC6040}.Release_Unity|Any CPU.ActiveCfg = Debug|Any CPU - {0C38DDF2-EAAA-43FA-BA0A-985636AC6040}.Release_Unity|Any CPU.Build.0 = Debug|Any CPU - {0C38DDF2-EAAA-43FA-BA0A-985636AC6040}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0C729EA7-A634-AFFF-6D19-20C29787045C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C729EA7-A634-AFFF-6D19-20C29787045C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0C729EA7-A634-AFFF-6D19-20C29787045C}.Release_NetFramework|Any CPU.ActiveCfg = Release|Any CPU - {0C729EA7-A634-AFFF-6D19-20C29787045C}.Release_NetFramework|Any CPU.Build.0 = Release|Any CPU - {0C729EA7-A634-AFFF-6D19-20C29787045C}.Release_Unity|Any CPU.ActiveCfg = Release|Any CPU - {0C729EA7-A634-AFFF-6D19-20C29787045C}.Release_Unity|Any CPU.Build.0 = Release|Any CPU - {0C729EA7-A634-AFFF-6D19-20C29787045C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0C729EA7-A634-AFFF-6D19-20C29787045C}.Release|Any CPU.Build.0 = Release|Any CPU - {8795B562-8178-4563-BA43-4157E9FED8D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8795B562-8178-4563-BA43-4157E9FED8D2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8795B562-8178-4563-BA43-4157E9FED8D2}.Release_NetFramework|Any CPU.ActiveCfg = Debug|Any CPU - {8795B562-8178-4563-BA43-4157E9FED8D2}.Release_NetFramework|Any CPU.Build.0 = Debug|Any CPU - {8795B562-8178-4563-BA43-4157E9FED8D2}.Release_Unity|Any CPU.ActiveCfg = Debug|Any CPU - {8795B562-8178-4563-BA43-4157E9FED8D2}.Release_Unity|Any CPU.Build.0 = Debug|Any CPU - {8795B562-8178-4563-BA43-4157E9FED8D2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8795B562-8178-4563-BA43-4157E9FED8D2}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {68C57430-3E92-4B50-A9A5-208FE9CCD914} = {12081C35-76DF-450C-AC83-1E1CB84516AA} - {76EB1952-7826-471C-9CF3-815D094DA077} = {6EC98884-A3DC-4828-85EF-5F10F7519429} - {08083F40-98AA-4176-BA01-817C18C35C7F} = {6EC98884-A3DC-4828-85EF-5F10F7519429} - {067BCC8C-FC25-4929-B4F4-C6A5A7496994} = {6EC98884-A3DC-4828-85EF-5F10F7519429} - {0C729EA7-A634-AFFF-6D19-20C29787045C} = {6EC98884-A3DC-4828-85EF-5F10F7519429} - {8795B562-8178-4563-BA43-4157E9FED8D2} = {3BC3CB3F-C3A1-BACA-1E5E-17DD6508E989} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {55AC11EF-F568-4C79-A356-7ED9510145B1} - EndGlobalSection - GlobalSection(SharedMSBuildProjectFiles) = preSolution - Runtimes\NET\BepInEx.NET.Shared\BepInEx.NET.Shared.projitems*{08083f40-98aa-4176-ba01-817c18c35c7f}*SharedItemsImports = 5 - Runtimes\NET\BepInEx.NET.Shared\BepInEx.NET.Shared.projitems*{0c729ea7-a634-afff-6d19-20c29787045c}*SharedItemsImports = 5 - BepInEx.Shared\BepInEx.Shared.projitems*{15f8bc38-a761-4f93-8903-1b531ac5d9f9}*SharedItemsImports = 5 - BepInEx.Shared\BepInEx.Shared.projitems*{4ffba620-f5ed-47f9-b90c-dad1316fd9b9}*SharedItemsImports = 5 - EndGlobalSection -EndGlobal diff --git a/BepInEx.slnx b/BepInEx.slnx new file mode 100644 index 00000000..d2ce13a9 --- /dev/null +++ b/BepInEx.slnx @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Runtimes/NET/BepInEx.NET.Common/BepInEx.NET.Common.csproj b/Runtimes/NET/BepInEx.NET.Common/BepInEx.NET.Common.csproj index a528cb75..84fab061 100644 --- a/Runtimes/NET/BepInEx.NET.Common/BepInEx.NET.Common.csproj +++ b/Runtimes/NET/BepInEx.NET.Common/BepInEx.NET.Common.csproj @@ -12,7 +12,7 @@ - + From 17001043b9b66db83be59b35ffb61ee36d4d1789 Mon Sep 17 00:00:00 2001 From: hazre Date: Wed, 16 Sep 2026 00:24:22 +0200 Subject: [PATCH 3/5] chore: move build to Cake 6 and git CLI helpers Signed-off-by: hazre chore: bump System.Drawing.Common to 10.0.12 Signed-off-by: hazre --- build/Build.csproj | 8 +++----- build/GitTasks.cs | 17 +++++++++++++++++ build/Program.cs | 9 +++------ 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/build/Build.csproj b/build/Build.csproj index 2b3166f4..3b71b93b 100644 --- a/build/Build.csproj +++ b/build/Build.csproj @@ -6,11 +6,9 @@ false - - - - - + + + diff --git a/build/GitTasks.cs b/build/GitTasks.cs index d793567c..648465ed 100644 --- a/build/GitTasks.cs +++ b/build/GitTasks.cs @@ -1,5 +1,13 @@ using Cake.Common; using Cake.Core; +using Cake.Core.IO; + +/// Represents a Git commit. +/// The full commit hash, represented as a hexadecimal string. +public sealed record GitCommit(string Sha); +/// Represents a Git branch. +/// The branch friendly name. +public sealed record GitBranch(string FriendlyName); static class GitTasks { @@ -9,4 +17,13 @@ public static string Git(this ICakeContext ctx, string args, string separator = process.WaitForExit(); return string.Join(separator, process.GetStandardOutput()); } + + public static GitCommit GitLogTip(this ICakeContext ctx, DirectoryPath repository) => + new(ctx.Git($"-C \"{repository.FullPath}\" rev-parse HEAD").Trim()); + + public static GitBranch GitBranchCurrent(this ICakeContext ctx, DirectoryPath repository) => + new(ctx.Git($"-C \"{repository.FullPath}\" rev-parse --abbrev-ref HEAD").Trim()); + + public static string GitShortenSha(this ICakeContext ctx, DirectoryPath repository, GitCommit commit) => + ctx.Git($"-C \"{repository.FullPath}\" rev-parse --short=7 {commit.Sha}").Trim(); } diff --git a/build/Program.cs b/build/Program.cs index d4e4fb08..53b2dc67 100644 --- a/build/Program.cs +++ b/build/Program.cs @@ -15,7 +15,6 @@ using Cake.Core.Diagnostics; using Cake.Core.IO; using Cake.Frosting; -using Cake.Git; using Cake.Json; using Microsoft.Build.Definition; using Microsoft.Build.Evaluation; @@ -126,12 +125,10 @@ public override void Run(BuildContext ctx) { ctx.Log.Information("Restoring dotnet tools..."); - var settings = new Cake.Common.Tools.DotNet.Tool.DotNetToolSettings + ctx.DotNetToolRestore(new Cake.Common.Tools.DotNet.Tool.DotNetToolRestoreSettings { WorkingDirectory = ctx.RootDirectory - }; - - ctx.DotNetTool("tool restore", settings); + }); ctx.Log.Information("Dotnet tools restored successfully."); } @@ -164,7 +161,7 @@ public override void Run(BuildContext ctx) }; } - ctx.DotNetBuild(ctx.RootDirectory.FullPath, buildSettings); + ctx.DotNetBuild(ctx.RootDirectory.CombineWithFilePath("BepInEx.slnx").FullPath, buildSettings); if (hasBepisLoader) { From 533e22a95dd77aafc61ca51a76effd2c8f4002ce Mon Sep 17 00:00:00 2001 From: hazre Date: Wed, 16 Sep 2026 01:44:02 +0200 Subject: [PATCH 4/5] chore: bump System.Drawing.Common to 10.0.12 Signed-off-by: hazre --- BepInEx.Core/BepInEx.Core.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BepInEx.Core/BepInEx.Core.csproj b/BepInEx.Core/BepInEx.Core.csproj index 99de45fe..e5c43281 100644 --- a/BepInEx.Core/BepInEx.Core.csproj +++ b/BepInEx.Core/BepInEx.Core.csproj @@ -14,7 +14,7 @@ - + From 2296312ae7ed6ad828b5856369318344fd5b06e0 Mon Sep 17 00:00:00 2001 From: hazre Date: Wed, 16 Sep 2026 17:31:16 +0200 Subject: [PATCH 5/5] chore: target .NET 10 only, drop Framework/Mono leftovers Signed-off-by: hazre --- BepInEx.Core/BepInEx.Core.csproj | 4 +--- BepInEx.Core/Console/Windows/Kon.cs | 7 ------- BepInEx.Core/Properties/AssemblyInfo.cs | 4 ---- BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj | 1 - BepInEx.Preloader.Core/Properties/AssemblyInfo.cs | 3 --- Runtimes/NET/BepInEx.NET.Common/BepInEx.NET.Common.csproj | 4 ---- 6 files changed, 1 insertion(+), 22 deletions(-) diff --git a/BepInEx.Core/BepInEx.Core.csproj b/BepInEx.Core/BepInEx.Core.csproj index e5c43281..8e657f4c 100644 --- a/BepInEx.Core/BepInEx.Core.csproj +++ b/BepInEx.Core/BepInEx.Core.csproj @@ -3,14 +3,12 @@ BepInEx Core library net10.0 true - true - @@ -22,7 +20,7 @@ - + diff --git a/BepInEx.Core/Console/Windows/Kon.cs b/BepInEx.Core/Console/Windows/Kon.cs index d6784f86..a3758710 100644 --- a/BepInEx.Core/Console/Windows/Kon.cs +++ b/BepInEx.Core/Console/Windows/Kon.cs @@ -1,9 +1,5 @@ using System; using System.Runtime.InteropServices; -#if NET35 -using System.Security.Permissions; - -#endif namespace BepInEx.ConsoleUtil { @@ -93,9 +89,6 @@ private static CONSOLE_SCREEN_BUFFER_INFO GetBufferInfo(bool throwOnNoConsole, o private static void SetConsoleColor(bool isBackground, ConsoleColor c) { -#if NET35 - new UIPermission(UIPermissionWindow.SafeTopLevelWindows).Demand(); -#endif var color = ConsoleColorToColorAttribute((short) c, isBackground); bool flag; var bufferInfo = GetBufferInfo(false, out flag); diff --git a/BepInEx.Core/Properties/AssemblyInfo.cs b/BepInEx.Core/Properties/AssemblyInfo.cs index 749dcc27..933ecc27 100644 --- a/BepInEx.Core/Properties/AssemblyInfo.cs +++ b/BepInEx.Core/Properties/AssemblyInfo.cs @@ -1,8 +1,4 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("BepInEx.Preloader.Core")] -[assembly: InternalsVisibleTo("BepInEx.Unity.Mono")] -[assembly: InternalsVisibleTo("BepInEx.NET.Framework.Launcher")] [assembly: InternalsVisibleTo("BepInEx.NET.CoreCLR")] -[assembly: InternalsVisibleTo("BepInEx.Unity.IL2CPP")] -[assembly: InternalsVisibleTo("BepInExTests")] diff --git a/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj b/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj index 5fe45f04..6ad56cef 100644 --- a/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj +++ b/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj @@ -8,7 +8,6 @@ - diff --git a/BepInEx.Preloader.Core/Properties/AssemblyInfo.cs b/BepInEx.Preloader.Core/Properties/AssemblyInfo.cs index 4a5feb71..a100cc0e 100644 --- a/BepInEx.Preloader.Core/Properties/AssemblyInfo.cs +++ b/BepInEx.Preloader.Core/Properties/AssemblyInfo.cs @@ -1,6 +1,3 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("BepInEx.Unity.Mono.Preloader")] -[assembly: InternalsVisibleTo("BepInEx.NET.Framework.Launcher")] [assembly: InternalsVisibleTo("BepInEx.NET.CoreCLR")] -[assembly: InternalsVisibleTo("BepInEx.Unity.IL2CPP")] diff --git a/Runtimes/NET/BepInEx.NET.Common/BepInEx.NET.Common.csproj b/Runtimes/NET/BepInEx.NET.Common/BepInEx.NET.Common.csproj index 84fab061..b7b0a55c 100644 --- a/Runtimes/NET/BepInEx.NET.Common/BepInEx.NET.Common.csproj +++ b/Runtimes/NET/BepInEx.NET.Common/BepInEx.NET.Common.csproj @@ -5,10 +5,6 @@ net10.0 - - - -