{"id":48958,"date":"2021-11-08T11:43:53","date_gmt":"2021-11-08T19:43:53","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/xamarin\/?p=48958"},"modified":"2021-11-09T11:11:47","modified_gmt":"2021-11-09T19:11:47","slug":"whats-new-in-xamarin-and-visual-studio-2022","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/xamarin\/whats-new-in-xamarin-and-visual-studio-2022\/","title":{"rendered":"What&#8217;s New in Xamarin and Visual Studio 2022"},"content":{"rendered":"<p>This week .NET Conf 2021 is celebrating the release of .NET 6, <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/\">Visual Studio 2022 is now available<\/a>, and we are happy to announce that Visual Studio 2022 also includes Xamarin support for Android 12, Apple&#8217;s latest Xcode 13 releases of iOS, iPadOS, macOS, and tvOS, and the latest Xamarin.Forms service releases that work with both. Let&#8217;s round up the latest Xamarin releases available today, revisit the Xamarin support policy, and look ahead at the road to .NET 6 and .NET MAUI coming in the second quarter of 2022.<\/p>\n<blockquote>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/\">.NET 6 is GA today<\/a> and <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-net-maui-preview-10\/\">.NET Muti-platform App UI (MAUI) support is on the way<\/a> for mobile and desktop! Today, continue building your production apps with Xamarin, check out the .NET MAUI previews as we work towards our release in Q2 2022, and when you&#8217;re ready try a migration of your projects with <a href=\"https:\/\/github.com\/dotnet\/maui\/wiki\/Migrating-from-Xamarin.Forms-(Preview)\">our .NET Upgrade Assistant<\/a>.<\/p>\n<\/blockquote>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2021\/11\/xamarin-vs22.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2021\/11\/xamarin-vs22.png\" alt=\"Xamarin in VS22\" width=\"1921\" height=\"1080\" class=\"aligncenter size-full wp-image-48960\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2021\/11\/xamarin-vs22.png 1921w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2021\/11\/xamarin-vs22-300x169.png 300w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2021\/11\/xamarin-vs22-1024x576.png 1024w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2021\/11\/xamarin-vs22-768x432.png 768w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2021\/11\/xamarin-vs22-1536x864.png 1536w\" sizes=\"(max-width: 1921px) 100vw, 1921px\" \/><\/a><\/p>\n<h2>Xamarin in Visual Studio 2022<\/h2>\n<p>Visual Studio 2022 introduces many improvements and new experiences, and Xamarin.Forms applications get these as well. The XAML Live Preview is one of the most exciting features that mirrors your running application within Visual Studio and enables adding layout guides and zooming to get your pixel perfect alignment. The Live Visual Tree allows you to see your UI hierarchy and locate the XAML source, and XAML Hot Reload continues to be improved as well.<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/releases\/2022\/release-notes\">Visual Studio 2022 Release Notes<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/releases\/2022\/release-notes#xaml-hot-reload\">XAML Hot Reload<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/releases\/2022\/release-notes#XAMLLivePreview-170\">XAML Live Preview<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/visualstudio\/xaml-tools\/inspect-xaml-properties-while-debugging\">XAML Live Visual Tree<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/xamarin\/xamarin-forms\/deploy-test\/hot-restar\">Xamarin Hot Restart<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/releases\/2022\/release-notes#known-issues\">Known Issue<\/a><\/li>\n<\/ul>\n<h2>Mobile and Cross-platform Sessions at .NET Conf 2021<\/h2>\n<p>Several sessions at <a href=\"https:\/\/www.dotnetconf.net\/\">.NET Conf<\/a> have content for building mobile, desktop, and cross-platform applications with .NET today. Anything that mentions &#8220;.NET MAUI&#8221; is for you. Be sure to check out <a href=\"https:\/\/www.dotnetconf.net\/agenda\">these sessions<\/a> among others:<\/p>\n<table>\n<thead>\n<tr>\n<th>Session<\/th>\n<th>Speaker(s)<\/th>\n<th>Date<\/th>\n<th>Time (Pacific)<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>.NET Conf Keynote<\/td>\n<td>Many<\/td>\n<td>Tuesday 11\/9<\/td>\n<td>8am<\/td>\n<\/tr>\n<tr>\n<td>Introduction to .NET MAUI<\/td>\n<td>Maddy Leger Montaquila<\/td>\n<td>Tuesday 11\/9<\/td>\n<td>10:30am<\/td>\n<\/tr>\n<tr>\n<td>Speed up your .NET Development with .NET Hot Reload<\/td>\n<td>Dmitry Lyalin<\/td>\n<td>Tuesday 11\/9<\/td>\n<td>11:30am<\/td>\n<\/tr>\n<tr>\n<td>Building cross-platform native apps with .NET MAUI and Blazor<\/td>\n<td>Eilon Lipton<\/td>\n<td>Tuesday 11\/9<\/td>\n<td>3:30am<\/td>\n<\/tr>\n<tr>\n<td>Drawn controls in .NET MAUI<\/td>\n<td>Javier Suarez Ruiz<\/td>\n<td>Thursday 11\/11<\/td>\n<td>2:00am<\/td>\n<\/tr>\n<tr>\n<td>Welcome to Maui Community Toolkit<\/td>\n<td>Pedro Jesus &amp; Gerald Versluis<\/td>\n<td>Thursday 11\/11<\/td>\n<td>3:30am<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><a href=\"https:\/\/www.dotnetconf.net\/agenda\">Complete agenda<\/a><\/p>\n<h2>Xamarin ships support for the latest mobile versions<\/h2>\n<p>Over the past several months, Xamarin has shipped several service release for Xamarin.Forms, and .NET bindings for both beta and stable releases from Google and Apple. These SDKs are available in the new stable release of Visual Studio 2022 and servicing releases of Visual Studio 2019 (Xcode 13.1 SDKs support is shipping in the next service release for Visual Studio 2019).<\/p>\n<ul>\n<li>Visual Studio 2022 (17.0) &#8211; <a href=\"https:\/\/visualstudio.microsoft.com\/downloads\/\">download<\/a><\/li>\n<li>Visual Studio 2022 for Mac (17.0) &#8211; <a href=\"https:\/\/visualstudio.microsoft.com\/downloads\/\">download<\/a><\/li>\n<li>Visual Studio 2019 (16.11.6) &#8211; <a href=\"https:\/\/visualstudio.microsoft.com\/downloads\/\">download<\/a><\/li>\n<li>Visual Studio 2019 for Mac (8.10.12) &#8211; <a href=\"https:\/\/visualstudio.microsoft.com\/downloads\/\">download<\/a><\/li>\n<\/ul>\n<h3>Xamarin.Forms 5<\/h3>\n<p>Xamarin.Forms 5.0 service release 6 shipped October 18th, bringing 145 fixes since 5.0 initially shipped January 5th. This includes support for Android 12 and iOS 15, and we are on pace to continue shipping service releases approximately every 6 weeks. Need a release sooner? Remember, you can <a href=\"https:\/\/www.youtube.com\/watch?v=tg3pyuIg55k\">download builds from GitHub and Azure Pipelines<\/a> from any pull request and commit. <a href=\"https:\/\/docs.microsoft.com\/xamarin\/xamarin-forms\/release-notes\/\">Full release notes are available<\/a>. Update your applications today using your favorite NuGet package manager, and you&#8217;ll be in the best position for later upgrading to .NET MAUI.<\/p>\n<h3>Android 12<\/h3>\n<p>Google has shipped their latest stable version of Android 12 which includes an all new Material You design language modernization of Material Design, updated widget designs, overall system performance improvements, and new features and APIs for camera, graphics and images, media, security and privacy, storage, and more. For a complete list of updates and documentation, visit the <a href=\"https:\/\/developer.android.com\/about\/versions\/12\/summary\">Android developer portal<\/a>.<\/p>\n<p>To support Android 12 we&#8217;ve updated to OpenJDK 11 from version 8, and updated the Android designer, SDK manager, and device manager for compatibility.<\/p>\n<h3>iOS 15, iPadOS 15, tvOS 15<\/h3>\n<p>Apple has shipped Xcode 13 which includes iOS 15, iPadOS 15, and tvOS 15. Last week Apple also shipped Xcode 13.1 which added support for macOS Monterey 12.<\/p>\n<ul>\n<li>Xcode 13 <a href=\"https:\/\/developer.apple.com\/documentation\/xcode-release-notes\/xcode-13-release-notes\">release notes<\/a><\/li>\n<li>Xcode 13.1 <a href=\"https:\/\/developer.apple.com\/documentation\/xcode-release-notes\/xcode-13_1-release-notes\">release notes<\/a><\/li>\n<\/ul>\n<h2>Xamarin Support for 2 Years<\/h2>\n<p>With the <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/update-on-dotnet-maui\/\">change in schedule<\/a> for shipping .NET MAUI and support for Android, iOS, and macOS in .NET 6, we want to update you on the support and servicing plan for Xamarin during this transition. Xamarin is governed by the <a href=\"https:\/\/dotnet.microsoft.com\/platform\/support\/policy\/xamarin\">Microsoft Modern Lifecycle<\/a> which states that the current Xamarin release is supported for two years after the initial release, or until a newer, subsequent Current release. .NET MAUI and related platforms will be covered by the <a href=\"https:\/\/dotnet.microsoft.com\/platform\/support\/policy\/dotnet-core\">.NET and .NET Core Support Policy<\/a> since, after all, it is a unified part of .NET now.<\/p>\n<p>This means, from the last current release of Xamarin you&#8217;ll get two years of supported service releases. As was just highlighted above, Android and iOS shipped new releases so you can expect support through November 2023. This the timeframe you have to move existing projects to .NET 6, and we are working to make this a smooth process for you.<\/p>\n<h2>Preparing your transition to .NET 6<\/h2>\n<p>In the second quarter of 2022 we will ship a supported version of .NET Multi-platform App UI (MAUI), the next version of .NET support for cross-platform, mobile and desktop applications. A top priority for this transition is to make sure that Xamarin applications can upgrade to take advantage of the latest advancements in .NET, C#, and Visual Studio without rewrite. This means a Xamarin project need only be moved from .NET Framework to .NET 6 and you can continue shipping.<\/p>\n<p>Let&#8217;s look first at what this means step-by-step for any Xamarin application.<\/p>\n<h3>Step 1: .NET Upgrade Assistant<\/h3>\n<p>The .NET Upgrade Assistant is a dotnet command-line tool that will perform the basic conversion of your project (csproj file) from the Xamarin .NET Framework style to the current SDK Style project that is commonly used by all other .NET project types. As you will recall, this transition unifies Xamarin with .NET so we share all the same tech and skills no matter what kind of apps we are building.<\/p>\n<h3>Step 2: Updating Dependencies<\/h3>\n<p>After converting the project file format, the tool will evaluate your project dependencies and report any incompatibilities for you to reevaluate. If you are using controls from a component vendor such as DevExpress, Infragistics, Steema, Syncfusion, Telerik, or others, they may already be available. Check with each for roadmap plans and availability.<\/p>\n<p>The Xamarin Community Toolkit is shipping two options for upgrading to .NET 6. The first is a 1-to-1 compatible version of the toolkit that is compatible with .NET 6. The second option is a pure .NET 6 version that takes advantage of all the architectural improvements in .NET, though may not yet have 1-to-1 parity with the Xamarin Community Toolkit; check to see if what you need is available.<\/p>\n<p>Xamarin.Essentials is now part of .NET 6 and .NET MAUI, so you will get that without any additional NuGet dependency.<\/p>\n<p>If your project is Xamarin.Android or Xamarin.iOS, then you may well be done right here. Compile and test your application.<\/p>\n<h3>Step 3 (optional): Xamarin.Forms to .NET MAUI<\/h3>\n<p>.NET MAUI uses the same control naming, layout naming, navigation patterns, and XAML features that your applications use in Xamarin.Forms. This means it will all work as-is. So what has changed?<\/p>\n<p>.NET MAUI uses the namespace &#8220;Microsoft.Maui&#8221; instead of &#8220;Xamarin.Forms&#8221;. The .NET Upgrade Assistant will have made this change for your in both your XAML and C# files. If you didn&#8217;t update NuGets that reference Xamarin.Forms types in the previous step with versions that now use Microsoft.Maui, then you&#8217;ll need to address those now.<\/p>\n<p>What other differences will you encounter?<\/p>\n<ol>\n<li>\n<p>App vs Window &#8211; Xamarin.Forms apps are single window, whereas .NET MAUI applications can be multi-window. This means the root view of the application has fundamentally been upgraded. We have preserved the style of App.cs (and App.xaml.cs) so your applications can continue to work as-is.<\/p>\n<\/li>\n<li>\n<p>Custom Renderers &#8211; .NET MAUI no longer needs them in the new &#8220;handler&#8221; architecture, however we provide a compatibility method for you to register them so you can continue to use them. For future needs, we recommend learning the handler pattern to customize platform control look and feel. For example, let&#8217;s say you have a custom renderer (<code>CustomEntry<\/code> in the library) for Android (<code>CustomEntryRenderer<\/code> in the Android project). To tell .NET MAUI where to find and how to use this renderer instead of the new handler, open the MauiProgram.cs in the root of your project where we have defined the app builder:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"language-csharp\">appBuilder\n    .UseMauiApp&lt;App&gt;()\n    .ConfigureMauiHandlers(handlers =&gt;\n    {\n#if __ANDROID__\n        handlers.AddCompatibilityRenderer(typeof(CustomEntry), typeof(Droid.Renderers.CustomEntryRenderer));\n#endif\n    });<\/code><\/pre>\n<p>That&#8217;s it. Do this for each renderer using the conditional compilation identifiers like <code>__ANDROID__<\/code>.<\/p>\n<ol start=\"3\">\n<li>\n    Effects &#8211; just like with custom renderers, you can register effects in the app builder.\n  <\/li>\n<\/ol>\n<pre><code class=\"language-csharp\">appBuilder\n    .UseMauiApp&lt;App&gt;()\n    .ConfigureEffects(effects =&gt;\n    {\n        effects.Add&lt;FocusRoutingEffect, FocusPlatformEffect&gt;();\n    });<\/code><\/pre>\n<p>Open your project in Visual Studio 2022 and start building. You may encounter a few type changes or incompatibilities. Resolve those and very soon you&#8217;ll have completed the transition to .NET 6.<\/p>\n<p>You can expect this to be anywhere from a few hours to a few days of work, depending on the complexity of your application and the availability of .NET 6 compatible dependencies.<\/p>\n<p>To attempt a migration today, please <a href=\"https:\/\/github.com\/dotnet\/maui\/wiki\/Migrating-from-Xamarin.Forms-(Preview)\">try out the .NET Upgrade Assistant<\/a> and provide feedback so we can continue to improve the assistant between now and our GA release.<\/p>\n<p>For additional examples of migrating projects from Xamarin.Forms to .NET MAUI, check out Javier Suarez Ruiz&#8217;s repository <a href=\"https:\/\/github.com\/jsuarezruiz\/xamarin-forms-to-net-maui\">Xamarin.Forms to ,NET MAUI<\/a>.<\/p>\n<h2>Starting Projects Today<\/h2>\n<p>.NET MAUI Preview 10 is available today in the Visual Studio 2022 preview channel, and Xamarin.Forms 5.0 is available. Both support the latest platform versions. If your project development timeline is longer than 4 months or everything you need is ready in .NET MAUI, then we recommend starting there. Otherwise, Xamarin.Forms is your best bet and you can see what lays ahead for you to transition to .NET 6 when you&#8217;re ready.<\/p>\n<p>Get started today with these resources:<\/p>\n<ul>\n<li>Visual Studio 2022 (17.0) &#8211; <a href=\"https:\/\/visualstudio.microsoft.com\/downloads\/\">download<\/a><\/li>\n<li>Visual Studio 2022 for Mac (17.0) &#8211; <a href=\"https:\/\/visualstudio.microsoft.com\/downloads\/\">download<\/a><\/li>\n<li>Visual Studio 2022 Preview (17.1) &#8211; <a href=\"https:\/\/aka.ms\/vs2022preview\">download<\/a><\/li>\n<li><a href=\"http:\/\/devblogs.microsoft.com\/dotnet\/announcing-net-maui-preview-10\/\">Announcing .NET MAUI Preview 10<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/dotnet\/maui\">.NET MAUI Documentation<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Xamarin has shipped support for the latest Android and iOS versions, and productivity features in Visual Studio 2022. What&#8217;s next for Xamarin?<\/p>\n","protected":false},"author":553,"featured_media":48960,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9211,313,5216,2,556,303,1,291,367],"tags":[27,16],"class_list":["post-48958","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-net-maui","category-android","category-announcements","category-developers","category-integrations","category-ios","category-xamarin","category-xamarin-platform","category-xamarin-forms","tag-xamarin","tag-xamarin-forms"],"acf":[],"blog_post_summary":"<p>Xamarin has shipped support for the latest Android and iOS versions, and productivity features in Visual Studio 2022. What&#8217;s next for Xamarin?<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/48958","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/users\/553"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/comments?post=48958"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/48958\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media\/48960"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media?parent=48958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/categories?post=48958"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/tags?post=48958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}