summary
This article mainly shares the operation and support of MAUI on m1 chip devices, and compiles the MAUI program we wrote into a version that supports the mac platform . When the m1 chip just came out, there were many development tools and applications that were not very friendly to the m1 chip, and various translation versions would appear. This piece of Microsoft's team support is good, so does MAUI, so don't worry about MAUI's poor support on m1 chip devices or other problems. If there is, I also believe that the Microsoft team can iteratively fix it in subsequent plans.
details
▌Hardware
I am currently using a notebook with a mac book pro m1 pro chip.
▌Software Environment
• Need to install the mac version of visual studio 2022 preview
address:
https://visualstudio.microsoft.com/en-hans/vs/mac/
• Install Xcode
Download and install: Open the app store and search for Xcode to find it.
• Preliminary work To demonstrate simplicity we create a "src" folder directly on the desktop.
• Open a "command window" in the current directory
• Enter the command: dotnet workload install maui
Install the relevant environment of maui on the mac platform.
• Enter the command: dotnet workload list
Check the workload.
• Enter the command: dotnet new maui
If there is a maui program written here, you can skip this step, and I will demonstrate directly creating a new maui empty project.
• Enter the command: dotnet new --install Microsoft.Maui.Templates::6.0.101-preview.10.2068
The version number here is adjusted according to your needs. After creating the app, you can open it in Visual Studio Code or Visual Studio (but Visual Studio doesn't know how to build it, so the same applies to running it). This is what it looks like in my code.
• Command input: dotnet build -t:Run -f net6.0-maccatalyst
To build and run for Mac, open a terminal in Visual Studio Code, or use the terminal used to create the template and run the following command, after a while, a window like the one below should appear.
Note I already have Xcode 13.1 installed on my machine, which I think is required to build MAUI apps. You may need to install it for this to work.
Congratulations, you just built and ran your first MacCatalyst MAUI application. If you want to build the Android or iOS version on Mac, you can run the following command.
- Mac OS: dotnet build -t:Run -f net6.0-ios
- Cyborg: dotnet build -t:Run -f net6.0-android
This is the same app running on the iPad mini simulator.
If you need to find more documentation content, you can refer to it.
Microsoft Most Valuable Professional (MVP)
The Microsoft Most Valuable Professional is a global award given to third-party technology professionals by Microsoft Corporation. For 29 years, technology community leaders around the world have received this award for sharing their expertise and experience in technology communities both online and offline.
MVPs are a carefully selected team of experts who represent the most skilled and intelligent minds, passionate and helpful experts who are deeply invested in the community. MVP is committed to helping others and maximizing the use of Microsoft technologies by Microsoft technical community users by speaking, forum Q&A, creating websites, writing blogs, sharing videos, open source projects, organizing conferences, etc.
For more details, please visit the official website:
https://mvp.microsoft.com/en-us
Long press to identify the QR code and follow Microsoft China MSDN
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。