{"id":39634,"date":"2022-04-26T12:09:52","date_gmt":"2022-04-26T19:09:52","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=39634"},"modified":"2022-04-27T22:59:58","modified_gmt":"2022-04-28T05:59:58","slug":"dotnet-maui-rc-2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-maui-rc-2\/","title":{"rendered":".NET MAUI Release Candidate 2 &#8211; With 100% More Tizen"},"content":{"rendered":"<p>We are excited to release .NET Multi-platform App UI (.NET MAUI) Release Candidate 2. This release is covered by a &#8220;go-live&#8221; support policy, meaning .NET MAUI is supported by Microsoft for your production apps. The team has been focused on stabilizing the toolkit, resolving the high impact issues you have been helping us to identify through your valuable feedback. Thank you!<\/p>\n<h2>Get Started Today<\/h2>\n<p>To acquire .NET MAUI RC2 on Windows, <a href=\"https:\/\/aka.ms\/vs2022preview\">install or update Visual Studio 2022 Preview<\/a> to version 17.2 Preview 5. In the installer, confirm .NET MAUI (preview) is checked under the &#8220;Mobile Development with .NET&#8221; workload.<\/p>\n<p>To use .NET MAUI RC2 on Mac, follow the <a href=\"https:\/\/github.com\/dotnet\/maui\/wiki\/macOS-Install\">command-line instructions<\/a> on the wiki. Support for .NET MAUI in Visual Studio 2022 for Mac will ship formally in a future preview.<\/p>\n<p>Release Candidate 2 <a href=\"https:\/\/github.com\/dotnet\/maui\/releases\/tag\/6.0.300-rc.2\">release notes are on GitHub<\/a>. For additional information about getting started with .NET MAUI, refer to our <a href=\"https:\/\/docs.microsoft.com\/dotnet\/maui\/get-started\/installation\">documentation<\/a> and the <a href=\"https:\/\/github.com\/dotnet\/maui\/wiki\/Migrating-to-RC1\">migration tip sheet<\/a> for a list of changes to adopt when upgrading projects.<\/p>\n<blockquote><p><strong>Reminder about Xamarin support<\/strong> The <a href=\"https:\/\/dotnet.microsoft.com\/platform\/support\/policy\/xamarin\">Xamarin Support Policy<\/a> is still in effect, which covers those products for 2 years after initial release. The last release was in November of 2021, so support will continue through November 2023.<\/p><\/blockquote>\n<h2>Adding Tizen Platform<\/h2>\n<p>Tizen.NET has long enabled .NET applications to run on millions of Samsung TVs, phones, and other devices running Tizen. Today, Tizen joins Android, iOS, macOS, and Windows as one of the target platforms you can reach with .NET MAUI. Congratulations to the Samsung Tizen.NET team on this great milestone!<\/p>\n<p>Visit the <a href=\"https:\/\/github.com\/Samsung\/Tizen.NET\">Tizen .NET introduction<\/a> to get started. While the platform support is part of .NET MAUI SDK and we&#8217;ve added the scaffolding for Tizen to the .NET MAUI template project, the required workload dependencies are distributed through a separate installation experience maintained by Tizen.<\/p>\n<p>Looking for samples? The Tizen team keeps up to date with all our beautiful sample apps to make sure they run great on Tizen mobile and Tizen TV.<\/p>\n<blockquote><p>The official Tizen Emulator supporting .NET 6 will be released by the Tizen team soon.<\/p><\/blockquote>\n<h3>HelloMaui<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/04\/hellomaui.gif\" alt=\"Tizen emulator\" \/><\/p>\n<p><a href=\"https:\/\/github.com\/Samsung\/Tizen.NET\/tree\/main\/samples\/HelloMaui\">Source<\/a><\/p>\n<h3>WeatherTwentyOne<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/04\/weather-tizen.gif\" alt=\"Tizen TV emulator running WeatherTwentyOne\" \/><\/p>\n<p><a href=\"https:\/\/github.com\/Samsung\/Tizen.NET\/tree\/main\/samples\/WeatherTwentyOne\">Source<\/a><\/p>\n<h3>.NET Podcast<\/h3>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/04\/podcast-tizen.gif\" alt=\"Tizen emulator and browser running dot net podcasts, .NET MAUI Release Candidate 2\" width=\"1263\" height=\"758\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/04\/podcasttv-tizen.gif\" alt=\"Tizen TV emulator running dot net podcasts\" \/><\/p>\n<p><a href=\"https:\/\/github.com\/Samsung\/Tizen.NET\/tree\/main\/samples\/dotnet-podcasts\">Source<\/a><\/p>\n<h2>Getting the most from platforms<\/h2>\n<p>.NET MAUI excels at giving you the same UI and styling for native controls across all supported platforms, while also giving you broad access to native platform features all from a single .NET language. .NET does this by taking full advantage of <a href=\"https:\/\/docs.microsoft.com\/dotnet\/standard\/library-guidance\/cross-platform-targeting#multi-targeting\">multi-targeting<\/a> to organize code and resources that may span several platforms from a single project.<\/p>\n<p>There may also be scenarios in your applications where you&#8217;ll want to customize how it looks and behaves on a specific platform in order to take full advantage of native features only present on that platform, or to unify an experience to be more consistent with other platforms. There are 3 main ways in which you can do this in .NET MAUI:<\/p>\n<h3>1. Platform folders<\/h3>\n<p>Within the single project structure, we&#8217;ve paved the way for you to put platform-specific code and files into folders by platform. The build tasks for .NET MAUI are pre-configured to know that anything you place there will apply only to that platform.<\/p>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/04\/solution_platforms.png\" alt=\"Solution shows platform folders, .NET MAUI Release Candidate 2\" width=\"654\" height=\"834\" \/><\/p>\n<h3>2. Filename convention<\/h3>\n<p>The .NET MAUI build tasks will also look at filename conventions to determine what code should run for each platform. The source code is actually setup this way as well. The <code>Button<\/code> handlers suffix the filenames by platform: Android, iOS, Tizen, and Windows.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/04\/button_handlers.png\" alt=\"Button handler files by platform\" \/><\/p>\n<h3>3. Conditional compilation<\/h3>\n<p>Multi-targeting also works via conditional compilation arguments. By using <code>#if<\/code>, you can segment code per platform from anywhere in your project. For example, in the <a href=\"https:\/\/github.com\/davidortinau\/WeatherTwentyOne\/blob\/main\/src\/WeatherTwentyOne\/MauiProgram.cs#L37-L46\">WeatherTwentyOne<\/a> app&#8217;s <code>MauiProgram.cs<\/code>, we configure services for local notifications and the system tray, which are very platform-specific APIs.<\/p>\n<pre><code class=\"language-csharp\">    var services = builder.Services;\r\n#if WINDOWS\r\n    services.AddSingleton&lt;ITrayService, WinUI.TrayService&gt;();\r\n    services.AddSingleton&lt;INotificationService, WinUI.NotificationService&gt;();\r\n#elif MACCATALYST\r\n    services.AddSingleton&lt;ITrayService, MacCatalyst.TrayService&gt;();\r\n    services.AddSingleton&lt;INotificationService, MacCatalyst.NotificationService&gt;();\r\n#endif\r\n    services.AddSingleton&lt;HomeViewModel&gt;();\r\n    services.AddSingleton&lt;HomePage&gt;();<\/code><\/pre>\n<p>By default, the following options are available to you:<\/p>\n<ul>\n<li>ANDROID<\/li>\n<li>IOS<\/li>\n<li>MACCATALYST<\/li>\n<li>TIZEN<\/li>\n<li>WINDOWS<\/li>\n<\/ul>\n<p>You&#8217;ll notice IntelliSense will additionally offer you more specific options to target each platform such as &#8220;WINDOWS10_0_17763_0_OR_GREATER&#8221; in case you need it.<\/p>\n<p>For additional information on writing platform-specific code, check out the .NET MAUI documentation:<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.microsoft.com\/dotnet\/maui\/platform-integration\/configure-multi-targeting\">Configure multi-targeting<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/dotnet\/maui\/platform-integration\/invoke-platform-code\">Invoke platform code<\/a><\/li>\n<\/ul>\n<p>.NET MAUI provides other helpful strategies for adapting your applications to different platforms, screen sizes, idioms, and more. For example, you can leverage these markup extensions and strategies:<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.microsoft.com\/dotnet\/maui\/xaml\/markup-extensions\/consume\">OnPlatform<\/a> &#8211; <code>WidthRequest=\"{OnPlatform 250, iOS=200, Android=300}\"<\/code><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/dotnet\/maui\/xaml\/markup-extensions\/consume\">OnIdiom<\/a> &#8211; <code>WidthRequest=\"{OnIdiom 100, Phone=200, Tablet=300, Desktop=400}\"<\/code><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/dotnet\/maui\/fundamentals\/triggers\">Triggers<\/a> &#8211; Property, Data, Event, Multi-triggers, EnterActions, ExitActions, and State<\/li>\n<\/ul>\n<h2>We need your feedback<\/h2>\n<p>Install the latest preview of Visual Studio 2022 for Windows (17.2 Preview 5) following our <a href=\"https:\/\/docs.microsoft.com\/dotnet\/maui\/get-started\/first-app\">simple guide<\/a> and build your first multi-platform application today.<\/p>\n<p>We&#8217;d love to hear from you! As you encounter any issues, file a <a href=\"https:\/\/github.com\/dotnet\/maui\/issues\/new\/choose\">report on GitHub at dotnet\/maui<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>.NET MAUI Release Candidate 2 is now available with dozens of bug fixes full support for Tizen. Get started today to build app for Android, Windows, iOS, and macOS.<\/p>\n","protected":false},"author":553,"featured_media":39635,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685,7233],"tags":[7239,7238,7246,7245,7622,7620,7621],"class_list":["post-39634","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-maui","tag-dotnet-6","tag-net-maui","tag-android","tag-ios","tag-macos","tag-release-candidate","tag-windows"],"acf":[],"blog_post_summary":"<p>.NET MAUI Release Candidate 2 is now available with dozens of bug fixes full support for Tizen. Get started today to build app for Android, Windows, iOS, and macOS.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/39634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/553"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=39634"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/39634\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/39635"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=39634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=39634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=39634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}