diff --git a/src/IKVM.MSBuild.Tasks/IKVM.MSBuild.Tasks.csproj b/src/IKVM.MSBuild.Tasks/IKVM.MSBuild.Tasks.csproj
index f6a393a0c5..04a32432b1 100644
--- a/src/IKVM.MSBuild.Tasks/IKVM.MSBuild.Tasks.csproj
+++ b/src/IKVM.MSBuild.Tasks/IKVM.MSBuild.Tasks.csproj
@@ -12,11 +12,13 @@
+
+
-
+
diff --git a/src/IKVM.MSBuild.Tasks/IkvmCompiler.cs b/src/IKVM.MSBuild.Tasks/IkvmCompiler.cs
index c6c52437d9..459c0d9436 100644
--- a/src/IKVM.MSBuild.Tasks/IkvmCompiler.cs
+++ b/src/IKVM.MSBuild.Tasks/IkvmCompiler.cs
@@ -1,6 +1,8 @@
using System;
using System.IO;
using System.Linq;
+using System.Reflection;
+using System.Runtime.InteropServices;
using System.Threading;
using IKVM.Tool.Compiler;
@@ -17,6 +19,20 @@ namespace IKVM.MSBuild.Tasks
public class IkvmCompiler : Task
{
+#if NETCOREAPP
+
+ ///
+ /// Initializes the static instance.
+ ///
+ static IkvmCompiler()
+ {
+ // preload Mono.Unix native library, MSBuild isn't capable of following dependency context
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && Environment.Is64BitProcess)
+ NativeLibrary.Load(Path.Combine(Path.GetDirectoryName(typeof(IkvmCompiler).Assembly.Location), "runtimes", "linux-x64", "native", "libMono.Unix.so"));
+ }
+
+#endif
+
///
/// Root of the tools director.
///