diff --git a/src/Microsoft.DotNet.MacOsPkg/Microsoft.DotNet.MacOsPkg.csproj b/src/Microsoft.DotNet.MacOsPkg/Microsoft.DotNet.MacOsPkg.csproj
index 831297d7606..09e39b08370 100644
--- a/src/Microsoft.DotNet.MacOsPkg/Microsoft.DotNet.MacOsPkg.csproj
+++ b/src/Microsoft.DotNet.MacOsPkg/Microsoft.DotNet.MacOsPkg.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/src/Microsoft.DotNet.MacOsPkg/Program.cs b/src/Microsoft.DotNet.MacOsPkg/Program.cs
index 80adca4b96f..90f13e41abb 100644
--- a/src/Microsoft.DotNet.MacOsPkg/Program.cs
+++ b/src/Microsoft.DotNet.MacOsPkg/Program.cs
@@ -2,10 +2,19 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
+
+#if !NET
+
+// This code is unreachable. Here to keep the compiler happy.
+throw new PlatformNotSupportedException("This tool is only supported on .NET Core.");
+
+#else
+
+using System.Runtime.InteropServices;
using System.CommandLine;
using System.IO;
-using System.Runtime.InteropServices;
-using Microsoft.DotNet.MacOsPkg;
+
+namespace Microsoft.DotNet.MacOsPkg;
public class Program
{
@@ -162,3 +171,4 @@ private static int UnpackCommand(ParseResult result, CliArgument unpackS
return 0;
}
}
+#endif