diff --git a/MCGalaxy/MCGalaxy_.csproj b/MCGalaxy/MCGalaxy_.csproj
index c22715fb3..d455a71bc 100644
--- a/MCGalaxy/MCGalaxy_.csproj
+++ b/MCGalaxy/MCGalaxy_.csproj
@@ -666,7 +666,7 @@
-
+
diff --git a/MCGalaxy/MCGalaxy_dotnet.csproj b/MCGalaxy/MCGalaxy_dotnet.csproj
index 3a790d728..61ce30c08 100644
--- a/MCGalaxy/MCGalaxy_dotnet.csproj
+++ b/MCGalaxy/MCGalaxy_dotnet.csproj
@@ -1,8 +1,9 @@
- netstandard2.0
+ net6.0
true
false
+ $(DefineConstants);MCG_DOTNET
diff --git a/MCGalaxy/MCGalaxy_standalone.csproj b/MCGalaxy/MCGalaxy_standalone.csproj
index c040799e8..c11dd4a35 100644
--- a/MCGalaxy/MCGalaxy_standalone.csproj
+++ b/MCGalaxy/MCGalaxy_standalone.csproj
@@ -1,9 +1,9 @@
- netstandard2.0
+ net6.0
true
false
- $(DefineConstants);MCG_STANDALONE
+ $(DefineConstants);MCG_DOTNET;MCG_STANDALONE
diff --git a/MCGalaxy/Modules/Compiling/CompilerBackends.cs b/MCGalaxy/Modules/Compiling/CompilerBackends.cs
index f721f3254..8518874a1 100644
--- a/MCGalaxy/Modules/Compiling/CompilerBackends.cs
+++ b/MCGalaxy/Modules/Compiling/CompilerBackends.cs
@@ -42,7 +42,7 @@ permissions and limitations under the Licenses.
namespace MCGalaxy.Modules.Compiling
{
-#if !NETSTANDARD
+#if !MCG_DOTNET
/// Compiles source code files from a particular language, using a CodeDomProvider for the compiler
public static class ICodeDomCompiler
{
diff --git a/MCGalaxy/Modules/Compiling/CompilerFrontends.cs b/MCGalaxy/Modules/Compiling/CompilerFrontends.cs
index 1f751bc5b..c3e083aac 100644
--- a/MCGalaxy/Modules/Compiling/CompilerFrontends.cs
+++ b/MCGalaxy/Modules/Compiling/CompilerFrontends.cs
@@ -30,7 +30,7 @@ public sealed class CSCompiler : ICompiler
public override string ShortName { get { return "C#"; } }
public override string FullName { get { return "CSharp"; } }
-#if !NETSTANDARD
+#if !MCG_DOTNET
CodeDomProvider compiler;
protected override ICompilerErrors DoCompile(string[] srcPaths, string dstPath) {
diff --git a/MCGalaxy/Server/Server.cs b/MCGalaxy/Server/Server.cs
index 516b4175b..bd0652a94 100644
--- a/MCGalaxy/Server/Server.cs
+++ b/MCGalaxy/Server/Server.cs
@@ -84,6 +84,7 @@ public static void Start() {
levelConfig = ConfigElement.GetAll(typeof(LevelConfig));
zoneConfig = ConfigElement.GetAll(typeof(ZoneConfig));
+ DotNetBackend.Init();
IOperatingSystem.DetectOS().Init();
StartTime = DateTime.UtcNow;
diff --git a/MCGalaxy/util/NetBackend.cs b/MCGalaxy/util/DotnetBackend.cs
similarity index 83%
rename from MCGalaxy/util/NetBackend.cs
rename to MCGalaxy/util/DotnetBackend.cs
index 61fbb4465..07abf46e1 100644
--- a/MCGalaxy/util/NetBackend.cs
+++ b/MCGalaxy/util/DotnetBackend.cs
@@ -23,7 +23,7 @@ permissions and limitations under the Licenses.
namespace MCGalaxy.Platform
{
-#if !NETSTANDARD
+#if !MCG_DOTNET
public static class DotNetBackend
{
public static void Init() { }
@@ -44,7 +44,13 @@ public static void Init() {
}
static IntPtr ImportResolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath) {
- return IntPtr.Zero;
+ IntPtr libHandle = IntPtr.Zero;
+
+ // Since otherwise it's not always found on Linux
+ if (libraryName == "sqlite3") {
+ NativeLibrary.TryLoad("libsqlite3.so.0", assembly, DllImportSearchPath.System32, out libHandle);
+ }
+ return libHandle;
}
@@ -63,8 +69,8 @@ public static Assembly ResolvePluginReference(string name) {
// https://learn.microsoft.com/en-us/dotnet/core/dependency-loading/default-probing?source=recommendations#how-are-the-properties-populated
try {
- AssemblyName name = new AssemblyName(name);
- string path = name.Name + ".dll";
+ AssemblyName assemName = new AssemblyName(name);
+ string path = assemName.Name + ".dll";
if (File.Exists(path)) return Assembly.LoadFrom(path);
} catch (Exception ex) {
Logger.LogError("Resolving plugin DLL reference", ex);
diff --git a/MCGalaxy/util/ImageUtils.cs b/MCGalaxy/util/ImageUtils.cs
index 92f93ffed..e53386a5b 100644
--- a/MCGalaxy/util/ImageUtils.cs
+++ b/MCGalaxy/util/ImageUtils.cs
@@ -16,7 +16,7 @@ software distributed under the Licenses are distributed on an "AS IS"
permissions and limitations under the Licenses.
*/
using System;
-#if !NETSTANDARD
+#if !MCG_DOTNET
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
@@ -55,7 +55,7 @@ public abstract class IBitmap2D : IDisposable
public abstract void Dispose();
-#if !NETSTANDARD
+#if !MCG_DOTNET
public static IBitmap2D Create() { return new GDIPlusBitmap(); }
#else
public static IBitmap2D Create() { return new ImageSharpBitmap(); }
@@ -94,7 +94,7 @@ static void OnDecodeError(Player p, IBitmap2D bmp) {
}
-#if !NETSTANDARD
+#if !MCG_DOTNET
unsafe sealed class GDIPlusBitmap : IBitmap2D
{
Image img;
diff --git a/MCGalaxy/util/OperatingSystem.cs b/MCGalaxy/util/OperatingSystem.cs
index 76b032b06..c6bdcdd34 100644
--- a/MCGalaxy/util/OperatingSystem.cs
+++ b/MCGalaxy/util/OperatingSystem.cs
@@ -183,7 +183,7 @@ protected virtual void RestartInPlace() {
execvp(exe, new string[] { exe, Server.RestartPath, null });
Console.WriteLine("execvp {0} failed: {1}", exe, Marshal.GetLastWin32Error());
-#if !NETSTANDARD
+#if !MCG_DOTNET
// .. and fallback to mono if that doesn't work for some reason
execvp("mono", new string[] { "mono", Server.RestartPath, null });
Console.WriteLine("execvp mono failed: {0}", Marshal.GetLastWin32Error());
diff --git a/README.md b/README.md
index 3c65d40a5..5ef4806b4 100644
--- a/README.md
+++ b/README.md
@@ -84,9 +84,6 @@ Compiling - .NET 6 / .NET 7 / .NET 8
* Compiling for .NET 7: Navigate into `CLI` directory, and then run `dotnet build MCGalaxyCLI_dotnet7.csproj`
* Compiling for .NET 8: Navigate into `CLI` directory, and then run `dotnet build MCGalaxyCLI_dotnet8.csproj`
-Linux notes:
-**You will also need to copy `libsqlite3.so.0` from system libraries to `libsqlite3.so` in the server folder**
-
Copyright/License
-----------------
See LICENSE for MCGalaxy license, and license.txt for code used from other software.