[Public] Troubleshooting IronPrint on macOS with .NET 8 (Apple Silicon)
Problem
Running IronPrint in a .NET 8 console application on macOS (Apple Silicon) may result in:
-
Build-time errors due to missing native libraries.
Printer.GetPrinterNamesAsync()
fails on macOS result in errorSystem.PlatformNotSupportedException: System.Drawing.Common is not supported on this platform.
Fix Steps
1. Install Required Native Libraries
Issue: macOS lacks libgdiplus
, which is needed by IronPrint and System.Drawing
.
Fix:
Install it via Homebrew:
brew install mono-libgdiplus
This mimics the GDI+ support available by default on Windows.
2. Update the Project Target Framework
Issue: net8.0
alone does not enable macOS-specific platform support.
Fix: In your .csproj
, set the target framework to:
<TargetFramework>net8.0-macos</TargetFramework>
This ensures that .NET uses macOS-specific APIs.
❗
net8.0-macos
is not included in the default console app templates. You may need to install the macOS workload or use a macOS app template for preconfigured support.
Sample
.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0-macos</TargetFramework>
<Nullable>enable</Nullable>
<UseSystemDrawing>true</UseSystemDrawing>
</PropertyGroup>
</Project>
Summary
✅ Task | Notes |
---|---|
Install libgdiplus |
brew install mono-libgdiplus |
Update .csproj |
<TargetFramework>net8.0-macos</TargetFramework> |
Use compatible API | Use ShowPrintDialogAsync() on macOS |