.NET 8 (Apple Silicon)이 지원하는 macOS에서의 IronPrint
Apple Silicon macOS에서 .NET 8 콘솔 앱으로 IronPrint를 실행하는 동안 네이티브 라이브러리가 누락되어 빌드 시 실패할 수 있으며, Printer.GetPrinterNamesAsync()가 런타임에 예외를 발생시킵니다.
System.PlatformNotSupportedException: System.Drawing.Common is not supported on this platform.
macOS는 IronPrint와 System.Drawing가 의존하는 GDI+ 구현 libgdiplus을 제공하지 않으며, 평범한 net8.0 타겟은 macOS 전용 플랫폼 API를 사용할 수 없습니다. 두 가지 문제를 해결해야 합니다.
해결책
1. 네이티브 GDI+ 라이브러리 설치
Windows에서 기본적으로 제공하는 GDI+ 지원이 macOS에서도 가능하도록 Homebrew를 통해 libgdiplus을 설치하십시오:
brew install mono-libgdiplus
brew install mono-libgdiplus
이 라이브러리가 없으면 System.Drawing는 호출할 네이티브 백엔드가 없습니다.
2. macOS 프레임워크 타겟
평범한 net8.0 대신 macOS 전용 타겟 프레임워크에서 .csproj를 지시하십시오:
<TargetFramework>net8.0-macos</TargetFramework>
<TargetFramework>net8.0-macos</TargetFramework>
.NET이 크로스 플랫폼 스텁이 아닌 macOS 플랫폼 API를 사용하도록 지시합니다.
net8.0-macos는 기본 콘솔 앱 템플릿의 일부가 아닙니다. macOS 워크로드를 설치하거나 macOS 앱 템플릿에서 시작하여 사전 구성된 지원을 받으십시오.전체 프로젝트 파일은 다음과 같습니다:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0-macos</TargetFramework>
<Nullable>enable</Nullable>
<UseSystemDrawing>true</UseSystemDrawing>
</PropertyGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0-macos</TargetFramework>
<Nullable>enable</Nullable>
<UseSystemDrawing>true</UseSystemDrawing>
</PropertyGroup>
</Project>
3. 호환 가능한 프린트 API 사용
macOS에서는 Windows 전용 인쇄 경로 대신 ShowPrintDialogAsync()을 호출하여 프린트 작업을 수행하십시오.

