locked
How to target MacOS and Windows using Xamarin Forms? RRS feed

  • Question

  • User341742 posted

    I want to use Visual Studio for Mac to write a c# .net Forms type application that will run on both MacOS and Windows. Ca I do this with Xamarin and VS for Mac? Is there a template somewhere for a Hello World that will do this? Run on both targets?

    Monday, January 6, 2020 8:38 AM

All replies

  • User176749 posted

    I am guessing that you mean UWP application for windows. No there is no template on VS for mac. you must use Windows for that. You can install a VM in your mac and add uwp application on your existing project or create a fresh project in Windows using VS for windows with default template which has android, ios, uwp... you can add mac project after that in your vs for mac. it is not included in the default template.

    Monday, January 6, 2020 9:13 AM
  • User369978 posted

    If you want to create forms project

    Template on mac

    Template on windows

    They are same thing , the project could run on both MacOS and Windows.

    Monday, January 6, 2020 12:09 PM
  • User37558 posted

    @arkon I'm struggling to get this to work. There is a walkthrough here: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/platform/other/mac

    But, it doesn't seem to work at all. When I install the XF package on Mac, the references are pointing to the .NET standard packages folder which is wrong because they don't contain any mac specific dependencies. And, even when I point the references to the correct place, the assemblies are missing code in the Xamarin.Forms.Platform.MacOS which is what we need to run this on macOS.

    I'd kill for a simple sample app that works on macOS.

    Saturday, August 1, 2020 9:41 PM
  • User341742 posted

    @MelbourneDeveloper said: @arkon I'm struggling to get this to work. There is a walkthrough here: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/platform/other/mac

    But, it doesn't seem to work at all. When I install the XF package on Mac, the references are pointing to the .NET standard packages folder which is wrong because they don't contain any mac specific dependencies. And, even when I point the references to the correct place, the assemblies are missing code in the Xamarin.Forms.Platform.MacOS which is what we need to run this on macOS.

    I'd kill for a simple sample app that works on macOS.

    Me too! All I want is to be able to write a .net c# app that runs on Windows 10 and MacOS and has a forms capability. Is there really no way to do this? I'd like to write the code once and deploy to both targets, so they look and behave identically on both.

    Monday, August 3, 2020 12:29 AM
  • User37558 posted

    I am starting the conversation again over here: https://forums.xamarin.com/discussion/184008/working-xamarin-forms-mac-sample#latest @arkon

    Someone is claiming they got it to work but never explained how.

    Monday, August 3, 2020 10:22 AM
  • User74 posted

    @MelbourneDeveloper said: I am starting the conversation again over here: https://forums.xamarin.com/discussion/184008/working-xamarin-forms-mac-sample#latest @arkon

    Someone is claiming they got it to work but never explained how.

    That was me, and as I said I followed those instructions. When I get time I'll go back and try again.

    Monday, August 3, 2020 1:18 PM
  • User37558 posted

    @JohnH sorry, I don't doubt that you got it working. But, unless I missed something in the process, the XF NuGet package is not including any of the mac specific code. I tried multiple walkthroughs that all recommended the same thing. There's a good chance I just missed a step.

    Monday, August 3, 2020 9:30 PM
  • User74 posted

    @arkon said: Me too! All I want is to be able to write a .net c# app that runs on Windows 10 and MacOS and has a forms capability. Is there really no way to do this? I'd like to write the code once and deploy to both targets, so they look and behave identically on both.

    Yes, we target iOS, Android, Mac and UWP with Xamarin.Forms. I posted a solution in the other thread that covers the first 3. It is simple to Add UWP as another platform.

    Saturday, August 8, 2020 9:40 AM