Xamarin with Visual Studio 2017 - Build native cross-platform apps

26 aug. 2022
Beginner
49,7K Views
5 min read  

Along with the launch of Visual Studio 2017, Microsoft has released many fresh and exciting features for mobile developers to develop cross-platform mobile apps using Xamarin. Visual Studio 2017 will help you to build better native cross-platform apps in less time as compared to Visual Studio 2015.

In this article, you will learn about how to setup Visual Studio 2017 for xamarin development and what are the new features Visual Studio 2017 supports for mobile apps development using C# and Xamarin.

Install the Visual Studio 2017 IDE

To get started with Xamarin apps development, download Visual Studio 2017 and install it on your windows machine. The VS 2017 is compatible with Windows7 SP1, 8, 8.1 and Windows 10. You can download it at Visual Studio 2017. I have installed it on Windows 10.

Install the Visual Studio 2017 IDE

Setting up Xamarin

Visual Studio 2017 is a lightweight IDE than ever! The new Visual Studio installer enables you to choose components which you want to install. This strategy keep the Visual Studio installation smaller than ever before and it installs the updates faster too.

Setting up Xamarin in Visual Studio 2017 IDE

Setting up Visual Studio 2017 for Windows Universal Platform Development

If you want to develop UWP apps using Xamarin then you have to install Universal Windows app components as well as shown in following fig.

Visual Studio 2017 for Windows Universal Platform Development

Setting up Visual Studio Emulators for Android and Windows 10

Visual Studio includes an Android emulator and Windows 10 Emulator that can be used to test and debug an Xamarin.Android and Xamarin Forms apps. The Android emulator uses the Hyper-V capabilities of development machine which results in faster launch and execution times than the default android emulator that comes with the Android SDK. To install both the emulators just navigate to individual components option and check the options in the following fig.

Install the Visual Studio 2017 IDE

Note

To run the visual studio emulators, your machine must meet the requirements to run Hyper-V. Hyper-V requires a 64-bit version of the Pro edition of Windows 8, Windows 8.1, Windows 10, or higher.

Install the Visual Studio 2017 IDE

Verify your Xamarin Installation

Once installation is complete, you should verify your Xamarin development environment.

Verify your Xamarin Installation

Visual Studio 2017 Xamarin.Forms Preview supports

With Visual Studio 2017 and latest release of Visual Studio for Mac, Xamarin.Forms XAML page you can preview in Xamarin.Forms Previewer to see expected layouts and design in Android and iOS device. make sure you have installed the latest Java 1.8 x64 for Android previewing. To open Xamarin.Forms Preview follow the following steps as shown in given fig.

XAML
Verify your Xamarin Installation

Improved Xamarin.Forms XAML IntelliSense

With Visual Studio 2017, any Xamarin.Forms XAML page now supports improved IntelliSense experience for code completion, bindings, custom properties, custom controls, converters, and much more.

Verify your Xamarin Installation

Creating Xamarin Forms App with Visual Studio 2017

In Visual Studio, create a new Blank App (Xamarin.Forms Portable) solution and name it XamarinFormsApp. You can find this template easily under Visual C# option for Cross-Platform.

Verify your Xamarin Installation

After clicking OK to create the solution, you’ll get two templates for creating app. Choose Blank app template with with UI technology Xamarin.Forms and Code Sharing Strategy Portable Class Libary (PCL).

Verify your Xamarin Installation

It will create a Xamarin Forms application with four projects targeting Android, iOS and Windows UWO app. Within each native project you have access to the native designer for the corresponding platform and can implement platform specific screens and functionality as needed.

Verify your Xamarin Installation

Now build the application and run it for Android device. You will get the following output in your Visual Studio Android Emulator.

Running Xamarin Forms App

Congrats, you have successfully build your first native cross platform mobile apps for Android, iOS and Windows UWP.

What do you think?

Thank you for your time, I hope you enjoyed this article and found it useful. Please add your comments and questions below. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.

Share Article
About Author
Shailendra Chauhan (Microsoft MVP, Founder & CEO at Scholarhat by DotNetTricks)

Shailendra Chauhan is the Founder and CEO at ScholarHat by DotNetTricks which is a brand when it comes to e-Learning. He provides training and consultation over an array of technologies like Cloud, .NET, Angular, React, Node, Microservices, Containers and Mobile Apps development. He has been awarded Microsoft MVP 8th time in a row (2016-2023). He has changed many lives with his writings and unique training programs. He has a number of most sought-after books to his name which has helped job aspirants in cracking tough interviews with ease.
Learn to Crack Your Technical Interview

Accept cookies & close this