What’s New for Xamarin Developers in Visual Studio 2019 version 16.5
This week, Visual Studio 2019 version 16.5 was released, bringing new features and improvements for mobile developers in Visual Studio to help you build better mobile apps, faster.
In this release, you will find:
- Xamarin Hot Restart: Test changes made to your app, including multi-file code edits, resources, and references while using a much faster build and deploy cycle. With Hot Restart, debug your iOS app built with Xamarin.Forms on a device connected to your Windows machine allowing for a much faster inner development loop.
- Android Apply Changes: Quickly see changes made to your Android resource files, such as layouts, drawables, etc., on an Android device or emulator without requiring the application to be restarted.
- Multi-Target Reload for XAML Hot Reload: Reload changes made to XAML instantly on multiple targets at the same time for rapid UI iteration, such as an iOS Simulator and Android emulator.
- Faster Android Startup: Generate your own custom profiles using startup tracing in your Android application providing improved application start-up with a minimal increase in app size.
- XAML Document Outline: See the hierarchy of your Xamarin.Forms UI in the Document Outline pane.
- XAML Previewer Opt-Out: Prefer runtime tooling over visual tooling when building Xamarin.Forms apps? Disable the XAML Previewer in the Xamarin settings in Tools > Options.
Faster Iteration with Xamarin Hot Restart
Xamarin Hot Restart works by pushing new changes to the existing app bundle when possible, vastly reducing the deployment time. It also supports changes to code files, resources, and references. Whether you are editing your view models or swapping image resources, Hot Restart lets you quickly push the changes to a device or emulator.
No project configuration required, so Hot Restart fits in easily and enhances your existing workflow. Additionally, when debugging your app, you can edit your C# code and press the restart button to apply the changes. Your app is automatically restarted so you can now test the new changes.
With Hot Restart you can debug your iOS app built with Xamarin.Forms on a device connected to your Windows machine. Allowing for a much faster inner development loop. Seeing this affect with the SmartHotel360 application. Their first builds are 69% faster, while incremental builds are 81% faster:
|Initial Build||Initial Deploy||Incremental Build||Incremental Deploy|
|w/o Hot Restart||172.7s||26.2s||37.2s||14.4s|
Thanks to the thousands of Xamarin developers who gave us feedback during the private preview phase! Xamarin Hot Restart is now available in Visual Studio 2019 version 16.5. See our Hot Restart documentation for information on how to get started.
Android Apply Changes
In our effort to examine how we can make Android developers more productive, we looked at the most common edit types. After discussion with developers like you, we found that Android resources, as well as layouts and drawables, made up a significant portion of edits.
In this release, we are introducing support for Android Apply Changes enabling you to make resource changes at runtime without having to restart your application.
Multi-Target Reload for XAML Hot Reload
XAML Hot Reload for Xamarin.Forms speeds up your development and makes it easier to build, experiment, and iterate on user interfaces. This means no longer having to rebuild your app each time you tweak your UI. Instead, it instantly reflects those changes in your running app!
When you’re writing your Xamarin.Forms UIs, you want to make sure it looks good on all your target platforms. Instead of debugging on one platform at a time to tweak your UI, why not work on many of them – like your Android emulator and iOS simulator – at once? XAML Hot Reload now works out-of-the-box with the multiple startup projects feature in Visual Studio:
Android Start-Up Performance
In a previous release, we had released a feature known as startup tracing. In which you use a default profile to improve the startup performance of your Android applications with a minimal increase to APK size.
This release, we are including MSBuild support for supporting custom profiles within startup tracing. So you can record your own custom profile based on your application’s needs at startup time. The generated profile can then be used instead of a default profile. Resulting in improved startup performance to an additional 40%, with a minimal increase to your APK size. For example, here is a table below against the Smart Hotel 360 sample application:
|Release||+ AOT||+ Start-Up Tracing||+ Custom Start-Up Tracing|
Get started with custom startup tracing by following the start-up tracing documentation.
XAML Document Outline
Xamarin.Forms developers already have access to a plethora of tooling to help build UIs faster. UIs such as XAML Hot Reload, control toolbox, and property panel. In addition to a powerful editing experience with IntelliSense. Our goal is to provide a delightful mix of design-time (such as toolbox, property panel, editor) and run-time (such as XAML Hot Reload) tooling to make building Xamarin.Forms UIs productive.
The Visual Studio 2019 version 16.5 release brings the Visual Studio Document Outline feature to XAML eabling you to see a hierarchy of your Xamarin.Forms UI in the Document Outline pane:
Open the document outline with Ctrl+Alt+T or via View > Other Windows > Document Outline.
XAML Previewer for Xamarin.Forms
We’ve heard feedback that sometimes, you want a lightweight XAML editor experience, especially when coding on-the-go. To help you streamline your development environment, turn off the XAML Previewer by changing your “Default XAML Editor” in Tools > Options > Xamarin > Xamarin.Forms XAML Previewer.
Even more from Visual Studio 2019 version 16.5!
That’s just a small peek at what’s available in Visual Studio 2019 version 16.5. It also includes smaller additions, such as bug and performance fixes, as well as updates to the project templates to feature CollectionView, and improved editing for Android XML constructs. For a complete overview of all that is available, check out the release notes.
Try everything mentioned above today! Download the Visual Studio preview, which can be installed side-by-side with your stable Visual Studio environment:
We are directly driven by your feedback, which means Visual Studio 2019 is full of features that were inspired by YOU, from XAML Hot Reload to faster Android build and deployment times! Make your voice heard by filing bug reports or sharing feature suggestions on Developer Community.