Forum Xamarin.Forms

Preview: Xamarin.Forms for macOS

DavidOrtinauDavidOrtinau USForum Administrator, Xamarin Team, Insider, University Xamurai

I hope you are taking an opportunity with the latest pre-release to experience your Xamarin.Forms apps running on macOS. It's a trip.

We want to kick off a thread to have some ongoing discussion about what's missing, what's not working, and where you'd like to see this go.

Please keep the discussion here on topic: macOS.



  • SjoerdvanNoortSjoerdvanNoort NLBeta ✭✭
    edited April 2017

    I've started experimenting. It seems to work functionally pretty well. But is looks very ugly.

    Text looks fuzzy.

    Also VerticalTextAlignment="Center" does not seem to work (works/looks fine on iOS):

    <TableView Intent="Settings">
            <TableSection Title="section1">
                <ViewCell >
                        <StackLayout Margin="15,0,15,0" Orientation="Horizontal">
                        <Label Text="Default" VerticalTextAlignment="Center" HorizontalOptions="StartAndExpand" />
                        <Label TextColor="Gray" x:Name="G1" Text="-"  HorizontalOptions="End" VerticalTextAlignment="Center" />
                        <Label TextColor="Gray" FontAttributes="Bold" Text="-"  HorizontalOptions="End" VerticalTextAlignment="Center" />

    But on mac the labels are top aligned

  • HalilDoganBolakHalilDoganBolak USMember ✭✭
    edited April 2017

    @DavidOrtinau - First of all, thank you and the Xamarin.Forms team very much for this. Many development teams around the world were eagerly waiting for Xamarin.Forms on Mac. Yes we all have seen the release discussion thread but the amount of information & guidance there was very little. Is there a small walk through or guideline on how to add the MAC OS to an existing Visual Studio 2015 multi-platform project ? For example, I got one that is currently implemented for iOS/Droid/UWP.

  • dave.9411dave.9411 USMember
    edited April 2017

    This is an amazing accomplishment. I am a long time OS X developer and have been dreaming about this for years. I hope this effort will get Xamarin's full backing and will reach the maturity of the other platforms. I have been playing with it since last night and it is very easy to implement. It seems too good to be true. I only hope that in the future it will be part of the Xamarin.Forms project template. I also hope OS X projects will be part of the Xaml previewer.

  • dave.9411dave.9411 USMember

    Any ideas how to get text to speech working on OS X in a dependency service? Can't find AVSpeechSynthesizer()

    using System;
    using AVFoundation;
    using AVKit;

    using Foundation;
    using WordGames.OSX;

    [assembly: Xamarin.Forms.Dependency(typeof(TextToSpeech_OSX))]
    namespace WordGames.OSX
    public class TextToSpeech_OSX : ITextToSpeech
    public TextToSpeech_OSX()

        public void Speak(string text)
            var speechSynthesizer = new AVSpeechSynthesizer();
            var speechUtterance = new AVSpeechUtterance(text)
                Rate = AVSpeechUtterance.MaximumSpeechRate / 4,
                Voice = AVSpeechSynthesisVoice.FromLanguage("en-US"),
                Volume = 0.5f,
                PitchMultiplier = 1.0f


  • MichaelZaletelMichaelZaletel USUniversity ✭✭
    edited April 2017

    A few tips for anyone trying to follow the blog tutorial here:

    1. Make sure that you right click on the References folder in the Mac project, choose Edit References and switch to the Projects Tab and check the box next to the Xamarin Forms Shared Project. (see attached)
    2. I am getting an error in the Mac project References folder on Xamarin.Mac (See attached) but it still seems to work
    3. Make sure to add the following using directives to AppDelegate.cs in the MacOS project
      using Xamarin.Forms;
      using Xamarin.Forms.Platform.MacOS;

    Michael Zaletel
    Enterprise Mobility @ Productive Edge
    Xamarin MVP
    Xamarin Elite Partner

  • JohnnieOdomJohnnieOdom USMember ✭✭
    edited May 2017

    Note that the "Forms App" template in VS.Mac will not work with the instructions to add MacOS to Forms. You will find yourself adding a bunch of other packages to satisfy dependencies and still get build errors even after they are all added.

    If you choose the "Blank Forms App" template, the instructions work as advertised.

    I agree that this is sort of the holy grail of app development for me. If I can write in C# and deploy one standard-ish project for OS X and iOS (and maybe Windows) then I've got everything I want.

  • DavidOrtinauDavidOrtinau USForum Administrator, Xamarin Team, Insider, University Xamurai

    @HalilDoganBolak said:
    @DavidOrtinau - First of all, thank you and the Xamarin.Forms team very much for this. Many development teams around the world were eagerly waiting for Xamarin.Forms on Mac. Yes we all have seen the release discussion thread but the amount of information & guidance there was very little. Is there a small walk through or guideline on how to add the MAC OS to an existing Visual Studio 2015 multi-platform project ? For example, I got one that is currently implemented for iOS/Droid/UWP.

    Today you cannot add a macOS project in Visual Studio 2015 as it requires a Mac. It's basically the same requirements as a Xamarin.Mac project.,_mac/#Requirements

    As we get further along the documentation team will provide some thorough guides. Until then, this feedback helps us know what that guide needs to cover, so thank you!

  • DavidOrtinauDavidOrtinau USForum Administrator, Xamarin Team, Insider, University Xamurai

    @MichaelZaletel thanks for the clarifications. I did have a bullet for "Reference your Xamarin.Forms project (shared or PCL)" but perhaps I should make that more clear. I'll update the post to reference the "using" statements. Good feedback!

  • DavidOrtinauDavidOrtinau USForum Administrator, Xamarin Team, Insider, University Xamurai

    @JohnnieOdom thx, we'll be reviewing the existing project templates and adding new templates to support macOS.

  • ChristopherHall.2518ChristopherHall.2518 USMember ✭✭

    Hi, I've just followed the instructions in the blog post and I can't build the result.
    I am using VS Mac Preview.

    When I use a 'Blank Forms App' with a shared project I see the following error:

    Line 5 of App.xaml.cs in my shared project.
    public partial class App : Application
    The type 'System.ComponentModel.INotifyPropertyChanged' is defined in an assembly that is not referenced. ...

    When I use a 'Blank Forms App' with a Portable Class Library I see the same error but on the line

    LoadApplication(new App())

    in the DidFinishLaunching override in my MacOS project.

    I can't find the System.ObjectModel assembly in the references editor.

    I have tried adding a reference to the System.ObjectModel assembly from


    this causes a new warning regarding assembly version mismatch which suggests adding the tag in the project file. Having added this tag the warning is removed but the error persists.

    Any suggestions as to how to fix this?

  • JeffLewisJeffLewis USMember ✭✭

    First off, I'm beyond excited by this announcement. I've been waiting literally for years for it. Thank you for making my day!

    However, I'm a bit confused... Xamarin.Forms iOS apps need a Mac to develop iOS apps yet can be developed on Windows (using remote build) - why is the macOS version different? Couldn't the same tooling in VS be used for that? I'm working on an app/application for Windows, Windows UWP, iOS and Android - and very much want to add MacOS to that - but being obligated to do that on a Mac really messes up my development process.

    I can see an argument that with native macOS Xamarin development you really do need to have access to the IB part of XCode.. but you don't for Forms... and this is Forms, not pure native.

    So.. long question short: any chance that if this gets to be more widely used, the tooling changes needed to make Xamarin.Forms/macOS building on Windows via remote building might happen?

  • JeffLewisJeffLewis USMember ✭✭
    edited May 2017

    One omission that in retrospect is kind of obvious given where Forms comes from... but it's kind of important:

    Nothing like a <Menu> and <MenuItem> object. Obviously not needed for mobile apps.. but... this is a desktop environment. I know you can do it procedurally.. but it's an odd disconnect.

    For people getting the missing Xamarin.Mac assembly, I don't know why - but I'm finding in the most recent install of VSMac, this happens by default. it's easy to fix: remove Xamarin.Mac from the references list, then add it back. That seems to fix it.

    Christopher Hall, have you added the Xamarin.Forms nuget package to your Forms.mac project (the one you just created)? Not having it included would cause the problems you're describing. If you're using a shared/portable library to hold your common code (which is the norm), you also have to put a reference to that in the Forms.mac project. Also check the Xamarin.Mac assembly and see if it's got the red x of death next to it. If it does, delete the reference and add it back in from the Assemblies tab.

  • biaparbiapar ITMember ✭✭✭

    Which is the status of this module?

  • VelocityVelocity NZMember ✭✭✭

    Will Xamarin.Forms for macOS support .NET standard?
    Reading this below had me a little worried...

    Not All NuGets are Ready for macOS
    In order to work in a macOS project, packages must target xamarinmac20. You may find that some of your beloved libraries do not yet support macOS. What can you do? Kindly send a request to the project’s maintainer to add it. Until they have support, you may need to look for alternatives.

    Eg. I raised this with James Newton-King for Newtonsoft.Json, and they have instead targeted .NET standard and would not be adding support for xamarinmac20.

  • rmarinhormarinho PTMember, Insider, Beta Xamurai

    @Velocity yap we are going to support when netstandard hits 2.0 we hope

  • VelocityVelocity NZMember ✭✭✭

    @rmarinho Thanks Rui - I guess this is an important requirement if the platform is to become production-ready.
    We are eager to adopt Xamarin.Forms for macOS, but have dependencies on packages like Newtonsoft.Json. Hopefully the timeline for this isn't too far out!

  • TechieRathoreTechieRathore INUniversity ✭✭

    Hey David (@DavidOrtinau), Thanks for releasing this awesome feature, I have a small query, currently I can have only one window open in the application at a time, Is it possible to support multiple windows. I apologize if the question is very basic as I am pretty new to Xamarin.Mac development and there is no classes in Xamarin University on this.

  • RobertHowardRobertHoward USMember ✭✭

    I assume there is no xaml previewer yet for macOS? Trying to build a new app with xamarin.forms (for the sole sake of not needing to screw with XCode) and it's a bit tedious without having a live previewer.

  • DavidOrtinauDavidOrtinau USForum Administrator, Xamarin Team, Insider, University Xamurai

    @SRaviKumar we don't have a method within Xamarin.Forms currently to launch additional Windows. It should work using the same code/pattern you would use with Xamarin.Mac.

    Presently this would mean creating 2 Xamarin.Forms app instances which isn't what I think you'd want, so we have work to do here.

  • DavidOrtinauDavidOrtinau USForum Administrator, Xamarin Team, Insider, University Xamurai

    @RobertHoward no XAML Previewer support, that's correct.

  • JamesGreen.8031JamesGreen.8031 GBMember ✭✭
    edited July 2017

    I'm just starting out looking at this stuff. I've done Xamarin stuff for Droid and iOS before so I'm not a complete Xamarin noob but the number of inconsistencies, general weirdness and foibles I'm encountering trying to get started with this is nothing short of profound.

    I've been following these two guides for using Xamarin.Forms with .NetStandard to target MacOS.

    I've not gotten far at all, I'm just trying to get the projects setup in Visual Studio for Mac. These blog posts I linked to above make this all sound like it works and is very simple. My experience has thus far been the polar opposite of this.

    I created a Blank Forms App rather than a Forms App as for some reason the Forms App insists I also want a WebAPI project, which I really don't.

    After creating this I created a .NETStandard project in order to pull over the XAML files as directed inthe blog posts and now this project insists on showing every file is duplicated with only one showing the *.cs file being associated with it.

    After trying to fix this and breaking the solutions a few times I managed to get to a point where the files were listed and I wasn't getting the DuplicateCompile Items exceptions on build.

    Now the only build problem I have is:

    "Error CS0103: The name 'InitializeComponent' does not exist in the current context (CS0103) (Oracle.UI)"

    The entire .CS files is:

    using Xamarin.Forms;
    namespace Oracle
        public partial class OraclePage : ContentPage
            public OraclePage()

    I've tried the obvious fix of matching up the XAML x:class="" declaration but this has no effect at all. I've gone through the .NETSTandard blog post time and time again and as far as I can tell I haven't missed anything out yet for me this results in a very broken experience and a project that wont even compile.

    I'm referencing the very latest pre-release of Xamarin.Forms in my .NetStandard project.

  • JamesGreen.8031JamesGreen.8031 GBMember ✭✭
    edited July 2017

    I've gotten a bit further with this but I'm now having a different issue. I've gotten a solution with a NetStandard Xamarin Forms project and a Cocoa App using Forms.

    However, when I compile the application I'm getting the following error:

    Error MM0023: Application name 'Oracle.exe' conflicts with another user assembly. (MM0023) (Oracle.MacOS)

    My Forms project and namespace is Oracle. If I change this to something like Oracle.UI and update all the namespaces in the classes the MacOS application refuses to recognise the App class from the Oracle solution.

    I'm stuck swapping between the error above and this error:

    Error CS0234: The type or namespace name 'App' does not exist in the namespace 'Oracle' (are you missing an assembly reference?) (CS0234) (Oracle.MacOS)

    Not sure how to move this forward.

    I'm assuming the issue with that there is an Oracle.dll and an Oracle.exe but I don't know what to do to fix this issue.

  • JamesGreen.8031JamesGreen.8031 GBMember ✭✭

    Bump, does anyone have any info on a potential fix for this?

  • rmarinhormarinho PTMember, Insider, Beta Xamurai

    Seems a namespace or dll conflit, can you post a link to the project so we take a look?


  • JamesGreen.8031JamesGreen.8031 GBMember ✭✭

    Hi Marinho,

    You cat get the project here:

  • RogerHardimanRogerHardiman GBMember ✭✭
    edited August 2017

    Mac builds can pick between two Target Frameworks (see Options->Build->General)
    a) Xamarin.Mac Modern
    b) Xamarin.Mac Full

    Is Xamarin Forms for Mac OS supposed to work with both frameworks?
    I can only get it working with Xamarin.Mac Modern.

    If the target is 'Full' then I have error in AppDelegate.cs
    AppDelegate.cs(30,30): Error CS0234: The type or namespace name 'MacOS' does not exist in the namespace 'Xamarin.Forms.Platform' (are you missing an assembly reference?) (CS0234)

    I'd be happy with 'Modern' except some of the Nugets I use (like NLog or Xam Plugins Gelocation) do not install in 'Modern' and wondered if I had missed something before trying to build Nlog myself.


  • RogerHardimanRogerHardiman GBMember ✭✭
    edited August 2017

    I noticed that MacOS Xamarin Forms is calling 'OnSleep' and 'OnResume' when the desktop window loses and gains the Focus. This is no good for me as I want to keep the application running while I do other things on the Mac (like interact with the IDE or the command line)

    Is there an official way to stop these events?

    For now I've used #if ... #endif to ignore the event (although I could have used a runtime platform test)

      public void OnSleep() {
          // Ignore OnSleep with MacOS desktop applications
          #if __MACOS__

    and define MACOS in the Project settings

  • RogerHardimanRogerHardiman GBMember ✭✭

    After reading more on the topic it looks like Xamarin Forms just targets xamarinmac20 which is the Xamarin.Mac Modern target.

  • HumbleArchitectHumbleArchitect USMember ✭✭

    @DavidOrtinau Thank you for working on Xamarin Forms for Mac. We are in the midst of a cross platform proof-of-concept where we would like to show Xamarin Forms for Mac. We are in a situation where we need to interop to a 3rd party library which is 32-bit. Unfortunately, the preview of Xamarin Forms does not work when we change the architecture from x86_64 to i386. Is there a plan for a preview that will support both the i386 and x86_64 architecture?

    I have attached a sample "Hello Forms" application which demonstrates the issue.

  • xyzMannxyzMann DEMember ✭✭

    I am also trying to use Xamarin.Forms for Mac!
    I took this manual:

    and when I start my app in debug mode everything runs fine.
    But when I want to create a release build I get this error:

    Build FAILED.

    /Users/xyz-mann/Projects/MacTest/MacTest/obj/x86/Release/mmp-cache/registrar.m(6277,11): warning GD811092D: duplicate protocol definition of 'WebResourceLoadDelegate' is ignored
    /Users/xyz-mann/Projects/MacTest/MacTest/obj/x86/Release/mmp-cache/registrar.m(6496,11): warning GD811092D: duplicate protocol definition of 'CALayerDelegate' is ignored
    /Users/xyz-mann/Projects/MacTest/MacTest/obj/x86/Release/mmp-cache/registrar.m(8691,2): warning GB7F1753F: method possibly missing a [super splitView:effectiveRect:forDrawnRect:ofDividerAtIndex:] call [-Wobjc-missing-super-calls]
    /Users/xyz-mann/Projects/MacTest/MacTest/obj/x86/Release/mmp-cache/registrar.m(6637,1): error G0BB64AFA: duplicate interface definition for class 'NSToolbarItemGroup'

    And I can't access Main.Storyboard cause of this error:

    Multiple types (NSToolbarItemGroup and AppKit.NSToolbarItemGroup) registered with the same Objective-C name: NSToolbarItemGroup

    note this also happen in a blank new app as soon as I am going to install Xamarin.Forms nugget pack

    Maybe someone else also have this problem and can help me? or is it known and will be fixed?


  • RogerHardimanRogerHardiman GBMember ✭✭

    I also have the same problem.
    MMP: Error MM4116: Could not register the assembly 'Xamarin.Forms.Platform.macOS': error MM4118: Cannot register two managed types ('NSToolbarItemGroup, Xamarin.Forms.Platform.macOS' and 'AppKit.NSToolbarItemGroup, Xamarin.Mac') with the same native name ('NSToolbarItemGroup'). (MM4116)

  • MarkoLudolphMarkoLudolph DEMember ✭✭

    I created a PR for this bug, But you don't need the storyboard at all, if you want to use Forms on the Mac.

  • DidsDids FIMember ✭✭
    edited August 2017

    Also seeing the same duplicate symbol error. Are any of you using a .NET Standard libraries with Forms by any chance? I am, and just wondering if that's affecting it.

    EDIT: Nope, tried with a shared project but with same results. I'm using VS4Mac with beta channel, so I guess that could also be related?

  • RogerHardimanRogerHardiman GBMember ✭✭

    Found a bug with DisplayActionSheet on XF for MacOS.
    If the list is long then the pop-up does not have any scroll bars to show the whole list of items and no way to reach the Cancel button at the bottom of the popup

  • RogerHardimanRogerHardiman GBMember ✭✭

    Bug 58779 has been filed for the DisplayActionSheet bug (when the list has 15 items and is taller than the screen height)

    I will add that I've now ported 2 Xamarin Forms applications to Xamarin Forms on the Mac. Both have custom renders which I ported over too. It is wonderful.

  • DavidOrtinauDavidOrtinau USForum Administrator, Xamarin Team, Insider, University Xamurai

    Thanks all for the feedback and helping hammer through these issues.

    Lots of macOS related fixes including the PR1097 are now available in 2.4.0-pre1. Update and continue to let us know how you get on.

  • RogerHardimanRogerHardiman GBMember ✭✭

    Found another bug. I use XF Properties classes to save and load user settings.
    Properties are serialised into a file called PropertyStore.forms which should be in IsolatedStorage.

    However on my Mac desktop, the file is located at /Users/myname/.config/.issolated_storage/PropertyStore.forms

    Two different XF Mac OS Desktop apps are accessing the same file and conflicting.
    Something is wrong as the properties are not in sub-directories that are app specific (so not really IsolatedStorage)

  • JeffLewisJeffLewis USMember ✭✭
    edited September 2017

    First off, I'm porting a utility from Windows desktop WPF to MacOS using Forms MacOS and overall, it's been amazingly simple to make everything work and this is so much nicer and easier to do than ObjC.

    BUT! (You knew there was a but coming)... There are a bunch of really odd problems. I'll dump them all here in a list but I can also post them on the GitHub. I'm using 2.4 pre 1

    1. I have a fairly simple ListView that's bound to a List<FileRow> where FileRow is just an object with four properties. It loads nicely, but on scrolling, it crashes with an "OutOfRange" error on "index". I've tried it with CachingStrategy set to Recycle and Retain. Both crash. The contents of the List doesn't change once loaded. There are only 89 items in the list.
    2. The buttons are... strange. They don't look like native MacOS buttons. Worse, someone added lines to the right and bottom to make them look kinda 3D, but you can't get rid of them. Even setting BorderColor to transparent doesn't help.
    3. My main window (well, my only window) is a tabbed page. The first page is a grid with three sections, two fixed (top and bottom) and the middle variable (height="*"). On loadup, the content isn't sized to the window, so the bottom section isn't visible as it's below the window. Resizing fixes this.
    4. There's no way to modify the menu bar. I've tried EVERYTHING including going to the Appkit directly and fiddling with it. There's also no way to create a menu bar attached to the window "Windows Style". Mac apps without menu bars are... exceptionally bizarre to use. I can create my own control that simulates a menu bar in the window, but that's very unMac-Like.
    5. No way to quit from the keyboard... or use any keyboard shortcuts as far as I can see.
    6. No way to maximise a window. The yellow dot is always greyed out.
  • JeffLewisJeffLewis USMember ✭✭

    First off, thank you for Xamarin.Forms MacOS. I've waited a long time for this day. :) Don't take the following as general criticism - Forms for Mac even now in a prerelease state is pretty amazing.

    However, a few problems. I'm using version 2.4 pre 1. I'm porting an app I wrote in Windows WPF over to MacOS. I won't go on about the arbitrary changes in naming conventions between WPF and Forms, I'm sure you've heard it a thousand times, but it is pretty annoying.

    1. Buttons are still pretty awful. They don't look like MacOS buttons. Worse, someone added a solid bar to the right and the bottom to give it a 3D-ish look and if you make the button transparent, they don't go away. Setting BorderColor transparent doesn't help either.
    2. I have a ListView bound to a List<FileRow> where FileRow is a simple class with four properties in it. There are 89 items in the list. They show correctly in the ListView, but scrolling will cause an OutOfBounds exception to be thrown on 'index'. I've tried setting the Caching Strategy to Recycle and Retain - both fail in the same way. The ItemTemplate is just a ViewCell containing a Grid and some Labels. The list doesn't change content once loaded.
    3. There's no way to modify the menu bar. MacOS apps without a menu bar are very strange things. I've tried everything even going down to native calls in AppKit and trying to modify the storyboard. Nothing works. There's no window specific menu bar either (a la Windows), and I could create my own controls for this.. but window specific menu bars are generally unknown in MacOS land.
    4. There doesn't seem to be any keyboard shortcuts at all. Not even the standard ones like command-Q and command-X V Z or Y. This may be because there's no menu bar, but it's kind of annoying.
    5. My window is a TabbedPage and it contains two ContentPages. The first one contains a Grid with three rows: two fixed height sections (top and bottom) and one variable (middle - height="*"). On load up, the contents render off the bottom of the window, hiding the third section. A resize of the window causes a rerender and it is ok then.
  • rogiheerogihee NLMember ✭✭✭

    @JeffLewis: I think there is some progress going on in the desktop-support branch, menu's (main menu bar and context menu's) seem to be have been implemented in Core and MacOS:

Sign In or Register to comment.