What’s New for Xamarin Developers in Visual Studio 2019 Preview 2

Pierce Boggan

Today, Visual Studio 2019 Preview 2 was released and includes many improvements for mobile developers in Visual Studio. This release, we focused on key areas to make you more productive when authoring Xamarin apps, including optimizations to build and deployment times as well as improvements to our UI authoring experiences.

You can try this release today by installing the Visual Studio 2019 Preview, which is available as a separate and sandboxed installation that can be installed side-by-side with Visual Studio 2017. This makes it safe to try without risking your production development environment. We’d love for you to give this release a try and let us know how it works for you and your team.

In this blog, we’ll take a look at new functionality for Xamarin developers in Visual Studio 2019 Preview 2.

Faster Inner Development Loop

Build-deploy-debug. The loop that developers repeat countless times in a given day. Over the past few Visual Studio releases, we have continued our effort to ensure you spend less time building and deploying and more time creating mobile apps. From your feedback, we found that we could get the highest impact by focusing on optimizing incremental builds and deployments.

Incremental build times in the Visual Studio 2019 Preview for the SmartHotel360 app are 29.66% better than the Visual Studio 2017 version 15.8 release, and deployment times are over twice as fast:

 

Step Visual Studio 2017 version 15.8 Visual Studio 2019 Preview 2 Delta
First Build 01:04.20 00:50.13 -21.95%
Incremental Build (XAML Change) 00:10.62 00:07.47 -29.66%
Deploy (XAML Change) 00:09.03 00:04.44 -50.83%

 

A full report of build performance profiling, as well as methodology, can be viewed on the Xamarin.Android wiki.

Enhanced Fast Deployment for Android

Fast deployment provides faster incremental deployment times (or deployments where you already have the app on a device) by skipping over redeployment of the Android package in scenarios where no changes have been made to assets, resources, shared native libraries packaged within the app, or user-defined classes that inherit from Java.Lang.Object.

Visual Studio 2019 Preview 2 adds support for enhanced fast deployment, which speeds up deployment times by only generating a new .apk file in a limited number of scenarios, such as when the AndroidManifest.xml file changes due to the addition of a new Application or Activity subclass.

To enable these enhancements, set the following MSBuild property in your Android project file:

<PropertyGroup> 
  <AndroidFastDeploymentType>Assemblies:Dexes</AndroidFastDeploymentType> 
</PropertyGroup>

Note that enhanced fast deployment is an experimental feature.

Improved UI Authoring

Visual Studio 2019 Preview 2 continues building on our progress from Preview 1 to improve our visual designers for iOS and Android. We also know that visual designers aren’t for everyone, so we’ve also continued to make improvements to our Android XML and Xamarin.Forms XAML authoring experiences in this release.

Xamarin.Forms

Property Panel

You can now edit common attributes for your Xamarin.Forms controls in the property panel for Visual Studio 2019 on Windows. Open the property panel by going to View → Properties Window. The property panel will show attributes for whatever control is currently in focus in your XAML file. Preview 2 adds support for even more property types.

XAML IntelliSense

In Visual Studio 2017, we heard your feedback and delivered and brand new IntelliSense experience for Xamarin.Forms that bring feature-parity with experiences that you know-and-love from WPF and UWP development, including improved matching, binding context IntelliSense, and Lightbulb suggestions.

We wanted to find ways to make you even more productive when editing code, so we announced IntelliCode which augments your IntelliSense experience by recommending commonly used items at the top of the completion list based on your context. Contextual recommendations are based on common practices developed in thousands of open-source code repositories. By predicting the most likely member in the list based on your coding context, AI-assisted IntelliSense keeps you from needlessly hunting through the list yourself:

 

 

 

We continue to make enhancements to IntelliCode with your feedback, so please give it a try and let us know what you think.

Android Designer

Based on your feedback, this release sports a few key improvements to the Android designer and Android XML authoring experiences. The Android designer now natively supports Android Pie (9.0) and provides autocompletion for ConstraintLayout attributes. We’ve also begun to improve the start-up speed of the Android designer to get you to the design surface faster.

By popular request, IntelliSense is now supported for Android XML files other than layouts, such as colors, strings, drawables, and the Android manifest. When adding controls to an Android layout, we will now automatically scaffold out a full snippet that includes required attributes by default. Finally, you can quickly navigate your Android XML files by using Go to Definition (Ctrl+Click) on resource URLs to navigate to the file and line where they are defined.

iOS Designer

The iOS storyboard designer already had support for custom controls, but a common request has been to render custom controls in the designer that need to load native dynamic libraries or frameworks (which is commonly used by many control vendors). This is now supported in Preview 2, shown here using SkiaSharp.

Smaller, faster Android apps

This release also adds support for two new features to provide faster builds, smaller APK binaries, and improved runtime performance:

  • d8 is a next-generation dex compiler that runs faster and produces smaller .dex files with better runtime performance
  • r8 is a new tool for shrinking and minification that converts java byte code to optimized dex code replacing the need for ProGuard

These enhancements provided a 9% improvement in build times when enabled on the SmartHotel360 app.

To enable these features, set the following MSBuild properties in your Android project file:

d8:

<PropertyGroup> 
  <AndroidDexTool>d8</AndroidDexTool>
</PropertyGroup>

r8:

<PropertyGroup> 
  <AndroidLinkTool>r8</AndroidLinkTool>
</PropertyGroup>

For more details, check out the documentation.

Xamarin.Forms Shell Project Templates

Xamarin.Forms 4.0 Preview adds a new way to quickly get started with Xamarin.Forms. This new concept, Shell provides a guided structure for setting up your applications navigation UI, a powerful new URI based navigation service, performance conscious data templates, and much more. Shell gives you 3 tiers of elements that describe your application. They then step aside to start populating the app with content and features. You could think of Shell as the evolution of MasterDetailPage, NavigationPage, and TabbedPage.

This release adds new project templates for Xamarin.Forms Shell, which can be accessed by searching for the Mobile App (Xamarin.Forms) template in Visual Studio, and selecting the Shell option:

So much more!

We’ve only scratched the surface of what’s new for Xamarin developers in Visual Studio 2019 Preview 2. There’s so much more to explore, including improved IDE performance, a smaller installation payload, and a new build status indicator.

Try this release today by installing the Visual Studio 2019 Preview, which is available as a separate and sandboxed installation and can be installed side-by-side with Visual Studio 2017. To log issues, please create a ticket via Help > Send Feedback > Report a Problem. If you have any other feedback on the release, don’t hesitate to reach out to Pierce Boggan at piboggan@microsoft.com.

0 comments

Discussion is closed.

Feedback usabilla icon