Skip to content

macos下avalonia示例代码无法跑起来 #78

Closed

Description

@gaoconggit

@claude 解决它

Activity

  1. claude commented on Nov 12, 2025

    @claude

    Claude finished @gaoconggit's task —— View job • claude/issue-78-20251112-1544 • Create PR ➔


    Fixed macOS Avalonia Compatibility Issues ✅

    I've successfully fixed the issues preventing the Avalonia desktop application from running on macOS.

    Changes Made

    1. Program.cs - STAThread Attribute

    Made the [STAThread] attribute Windows-only using conditional compilation:

    #if WINDOWS
        [STAThread]
    #endif
    public static void Main(string[] args)

    The STAThread attribute is Windows-specific and causes issues on macOS/Linux.

    2. SharpPad.Desktop.csproj - Windows-Only Features

    • Made BuiltInComInteropSupport conditional (Windows-only)
    • Made ApplicationManifest conditional (Windows-only)

    Both COM interop and app manifests are Windows features that don't apply to macOS.

    3. MainWindow.axaml - Icon Path

    Removed the hardcoded Windows icon path from the XAML. The icon is already properly configured in the .csproj with platform-specific conditions.

    Build Status

    ✅ Build now succeeds with 0 warnings and 0 errors

    The desktop application should now run properly on macOS while maintaining full compatibility with Windows and Linux.

    Next Steps

    You can now:

    1. Run the application on macOS using: dotnet run --project SharpPad.Desktop/SharpPad.Desktop.csproj
    2. Build a macOS app bundle using the provided script: ./package-macos.sh

    | Branch

  2. added a commit that references this issue on Nov 12, 2025
    be645f1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions