How to install Xamarin on Visual Studio and system?
16 minute(s) read
Oct 03, 2021
Xamarin can be installed on Windows and Mac operating systems, but the method and steps of installation on each operating system are different. This tutorial includes a step-by-step tutorial on installing Xamarin on different Windows and Mac operating systems.
Install Xamarin on Windows
1- Download Visual Studio 2019 from Visual Studio site and source.
2- Perform the installation steps by double-clicking.
3- Then select Mobile development with .NET for installation on the opened page and start the installation process again.
4- Select Install and click to begin the installation process.
5- It takes a while to complete the installation process. After completing the installation process, select and launch to run it.
6- After installing Visual Studio, it is time to add Xamarin to Visual Studio.
7- After you install Xamarin, you can restart it, in which case Xamarin will be added to Visual Studio.
8- To make sure whether Xamarin has been added to Visual Studio or not, you can click on the Help menu and see if Xamarin is installed or not.
9- Another way to make sure whether Xamarin has been added to Visual Studio or not, you can go to Help> About Microsoft Visual Studio and see Xamarin in the list of added programs.
Add Xamarin.Ios to Visual Studio
After installing Xamarin, we need to add Xamarin.Ios to Visual Studio as well.
Here are some things we need to do to build applications using Xamarin.Ios:
A system with Windows operating system on which visual studio 2019 is installed.
A Mac operating system that also has access to Apple’s build tool and Xamarin.Ios and also connects to the Internet.
Visual Studio 2019 accesses the system via the web and can use Apple’s build tool to compile.
Set up Xamarin.Ios in Visual Studio
1- To make Xamarin.Ios settings, you must install Visual Studio 2019 on your Windows system.
2- Reinstall Xcode and Visual Studio on your Mac.
In order to be able to build and debug and sign iOS applications , Apple’s development tools (Xcode) and Xamarin.Ios must be connected to the Mac build host configured via the Internet.
3- In the next step, you need to install Visual studio2019 on your Mac system.
In order for visual studio 2019 to be able to use the ios build tools to get help connecting to the Mac, connect to both Mac and Windows systems over the network.
Install Xamarin.android on Windows
Today, with new updates to Xamarin and Visual Studio, Xamarin includes all the editions that previously existed in Visual Studio. Of course, all these editions are available at Xamarin at no cost and can be used. For this reason, you can use visual studio installer to download and install xamarin. android tools, in this method, there is no need to download and install some licenses.
In this part of the Xamarin.android installation tutorial, you will learn the following:
- How to determine the right place to store Java development kit, Android SDK and Android NDK?
- How to set up an Android device for troubleshooting and testing.
- How to create and launch the first Xamarin.android project.
After following this tutorial, you will have an Xamarin.android installed on your system that is ready to create your first project and you can easily create and launch your first project.
After installing Xamarin on Visual Studio, we have to adjust it. Install Xamarin according to the tutorials listed above and add it to Visual Studio.
Android API level settings are used to find similarities between your application and different versions of Android. Android API levels that you select and use to build and create applications can require different Android SDKs. This means that the number of Android SDKs you have to install can vary depending on the Android API level you choose. If needed, you can also install emulator images inside the Android SDK through the Android SDK Manager. The access path to these Tools is> Android> Android SDK Manager.
Note that Visual Studio installs Google Android SDK Manager by default.
All versions of Android SDK Tool package before version 25.2.3 can be installed using Google Android SDK Manager, but if you want to install higher versions, you must install the plugin called Xamarin Android SDK plugin on Visual Studio and add.
Android emulator can be useful and used in building and executing projects and applications .
In this case, if a physical device such as a phone or tablet is not available, the result and launch of the application can be done virtually in the software. Android emulator provides application environment in hardware such as tablet and phone and you can easily see and test this environment through this simulator.
The Android device emulator in the system includes the following:
This simulator includes QEMU, which can generate and build virtual devices for workspaces.
An Emulator Image is a template, image or emulator image of an operating system or hardware that must be simulated; In other words, the virtual image has the environment to be simulated. For example, you can use the image emulator to show the hardware and device needed to emulate the Nexus 5X, which will run Android 7.0 and have Google play service installed. Android Virtual Device (AVD) is a physical device built and simulated in an image emulator. When applications built using Xamarin want to start testing, Xamarin.android activates the emulator, installs the APK, and runs the application.
There are technologies that you can use to improve the quality and performance of the simulation, so if you use systems and computers based on x86, use the following two technologies to increase and improve the quality be.
Microsoft’s Hyper-V is a technology for computers running Windows 10 and above with the April2018 update.
How to build the first application after the installation process?
Requirements for performing these steps of training and building and designing the application:
Visual Studio 2019 or versions 15.8 or higher
1- To create the first project and build the first application , you must go to File> New> Project so that you can create the first project and create your desired application.
2- Then you have to select New Project which is under the templates option.
3- To specify the output type of the application that you want to design and build , select the android app on the right and specify the application type and its output.
4- Then you can give the desired name to the application you want to design. After you put the desired name on the project and application, you can close the naming window by pressing the ok button.
In this tutorial, the name of the application we want to create and design MyApp has been selected.
5- In the Blank App section, you must click on the New Android App and select it and click the ok button.
6- In the Solution Explorer section, open the layout folder inside the Resources folder.
7- Double-click on activity_main. axml in the layout folder to activate the Android designer and you can apply the changes you want to it.
The layout actually exists in content_main. axml instead of in activity_main. axml.
Layout is RelativeLayout by default. For this reason, in order to be able to continue training without any problems, we need to change the
8- In the Toolbox section on the left, enter the word Text in the search field so that you can drag the Text (Large) widget on the screen.
9- By selecting Properties, you can change the properties and appearance of the Text (Large) widget.
10- Select the Plain Text widget from the Toolbox and drag it into the page and place it under the Text (Large) widget.
Of course, you should note that you have to move the mouse pointer on the screen and you cannot place the widget until it determines the appropriate place to place the widget. So you have to move the mouse pointer so that you can finally find the right place.
11- After you put Plain Text, you have to go to the Properties section to change the ID attribute.
12- Click on Properties to change its ID attribute to @ + id / PhoneNumberText.
Also change the Text property to 1-855-XAMARIN.
13- From the Toolbox, select a Button tool and drag it to the page and place it under the Plain Text widget.
14- Select the Button tool and change the Text property to Translate from the Properties section.
15- Change its ID attribute to id / Translate Button + @.
16- From the Toolbox, select the TextView tool and drag it inside the page and place it under the Button widget.
17- Select the Text property of the TextView tool as empty strings and change its Id property to id / TranslatedPhonewor @ +.
18- Save all the changes and operations you performed by pressing CTRL + S.
19- In the Solution Explorer section, click on the project name and go to Add> Item New ...
20- In the Add New Item window that opens, select Visual C #> Code> Code File.
21- By doing this, you create an empty and new C # class.
22- Put the codes entered below into the new and created empty class.
public static class PhonewordTranslator
public static string ToNumber (raw string)
if (string. IsNullOrWhiteSpace (raw))
elsewNumber = new StringBuilder ();
foreach (var c in raw)
if ("-0123456789". Contains (c))
var result = TranslateToNumber (c);
if (result! = null)
// otherwise we've skipped a non-numeric char
return newNumber.ToString ();
static bool Contains (this string keyString, char c)
return keyString.IndexOf (c)> = 0;
static int? TranslateToNumber (char c)
if ("ABC". Contains (c))
else if ("DEF". Contains (c))
else if ("GHI". Contains (c))
else if ("JKL". Contains (c))
else if ("MNO". Contains (c))
else if ("PQRS". Contains (c))
else if ("TUV". Contains (c))
else if ("WXYZ". Contains (c))
23- Save all the changes and operations you performed by pressing CTRL + S.
24- In order to connect the user interface and the application to each other and communicate between them, you must put the following code on the buttons to perform the operation you want.
25- Put the following code in the OnCreate method. base. OnCreate (savedInstanceState) and Call SetContentView (Resource.Layout. activity_main)
using Android.Support. V7. App;
[Activity (Label = "@ string / app_name", Theme = "@ style / AppTheme", MainLauncher = true)]
public class MainActivity: AppCompatActivity
protected override void OnCreate (Bundle savedInstanceState)
base. OnCreate (savedInstanceState);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout. activity_main);
// New code will go here
26- Call SetContentView, then add the code below to the OnCreate method.
// Get our UI controls from the loaded layout
EditText phoneNumberText = FindViewById (Resource.Id. PhoneNumberText);
TextView translatedPhoneWord = FindViewById (Resource.Id. TranslatedPhoneword);
Button translateButton = FindViewById (Resource.Id. TranslateButton);
27- Then add the following codes.
// Add code to translate number
translateButton.Click + = (sender, e) =>
// Translate user's alphanumeric phone number to numeric
string translatedNumber = Core. PhonewordTranslator. ToNumber (phoneNumberText.Text);
if (string. IsNullOrWhiteSpace (translatedNumber))
translatedPhoneWord.Text = string. Empty;
translatedPhoneWord.Text = translatedNumber;
28- Save all the changes you made by pressing the combination keys or going to File> Save All or CTRL-SHIFT-S.
If you notice an error, it is best to go through the steps again. If other errors occur, make sure the namespace in MainActivity.cs is the same as the project name.
Your program and application is present.
In this tutorial you were able to install XAMARIN.ANDROID and design the first application in it.About our Android and iOS app development services