<commit_before><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link type="text/css" rel="stylesheet" href="bootstrap.min.css" />
<title>Xamarin Development Guide</title>
</head>

<body>

<style type="text/css">
div.image-container > p {
    margin-top: -5px;
    font-style: italic;
    font-size: small;
    font-weight: 300;
    }
</style>
<h3>Introduction</h3>
<p>Xamarin is a cross-platform UI toolkit that allows developers to efficiently 
create native cross platform user interface layouts.<br>
This document is intended to show how to setup a Xamarin development environment 
and introduce existing features and user interfaces on Asp.Net Zero Xamarin platform.
For an overview of the Xamarin installation and setup practices see
<a href="https://developer.xamarin.com/guides/xamarin-forms/getting-started/installation/">
Xamarin.Forms Requirements</a> and
<a href="https://developer.xamarin.com/guides/cross-platform/getting_started/installation/">
Installation</a>. <br>
For an overview of the Asp.Net Zero getting started see
<a href="Getting-Started-Core">Asp.Net Zero Getting Started.</a> The Asp.Net Zero 
Xamarin is only available for Asp.Net Core included Angular UI and Mvc UI.</p>
<h4>Prerequisites</h4>
<p>Following tools are needed in order to develop ASP.NET Zero Xamarin:</p>
<ul>
	<li><a href="https://www.visualstudio.com">Visual Studio 2017 v15.4.4</a>+</li>
	<li>MAC for IOS simulator</li>
</ul>
<p>Asp.Net Zero Xamarin applications can be written for the following operating 
systems:</p>
<ul>
	<li>iOS 8 or higher</li>
	<li>Android 4.0.3 (API 15) or higher (<a href="https://developer.xamarin.com/guides/xamarin-forms/getting-started/installation/#android">more 
	details</a>)</li>
</ul>
<h4>Android</h4>
<p>You should have the latest Android SDK Tools and Android API platform installed. 
You can update to the latest versions using the
<a href="https://developer.xamarin.com/guides/android/application_fundamentals/using-the-sdk-manager/">
Android SDK Manager</a>.</p>
<p>Additionally, the target/compile version for Android projects <strong>
<span style="font-weight: 400">must</span></strong> be set to <b><em>Use latest 
installed platform</em></b>. However the minimum version can be set to API 15 so 
you can continue to support devices that use Android 4.0.3 and newer. </p>
<p>These values are set in the <strong>Project Options</strong>:</p>



<ide name="vs" class="ide-show">

<p><strong>Project Options &gt; Application &gt; Application Properties</strong></p>
</ide>

 
<img class="img-thumbnail" alt="Xamarin Android Options" src="images/options-android-vs-sml.png" />
<h4>Mac System Requirements</h4>
<p>You can use Visual Studio for Mac to develop Xamarin.Forms apps on OS X El Capitan 
(10.11) or newer. To develop iOS apps, it is recommended having at least the iOS 
10 SDK and Xcode latest installed.</p>
<h4>Windows System Requirements</h4>
<p>Xamarin.Forms apps for iOS and Android can be built on any Windows installation 
that supports Xamarin development. A networked Mac is required for iOS development.
</p>
<h4>Solution Structure (Layers)</h4>
<p>After you <a href="/Download">download</a> your project, you will see 3 types 
of solutions;</p>
<ul>
	<li><strong>.Mobile</strong> Xamarin and related projects included.</li>
	<li><strong>.Web</strong> Web and related projects included.</li>
	<li><strong>.All</strong> All the projects included.</li>
</ul>
<p>For Xamarin development, you can open <b>.Mobile.sln</b>.</p>
<div class="image-container">
   
   <img class="img-thumbnail" alt="ASP.NET Zero Xamarin Architecture" src="images/xamarin-architecture.png"/>	
	<p>Xamarin Architecture</p>
</div>
<div class="image-container">
	<img class="img-thumbnail" alt="ASP.NET Zero Mobile Solution" src="images/mobile-solution-overview.png"/>
	<p>Mobile Solution</p>
</div>
<p>There are 6 projects in the mobile solution:</p>
<ul>
	<li><strong>Core.Shared</strong> project contains basic primitive types like consts, enums that
	used in all layers of the solution.</li>
	<li><strong>Application.Shared</strong> project contains data transfer objects 
	(DTOs) and interfaces of application services shared with application layer 
	of the backend.</li>
	<li><strong>Application.Client</strong> project contains Web Api client (bridge 
	between mobile app and host) and proxy classes of Application Services.</li>
	<li><strong>Mobile.Shared </strong>project houses the code shared by IOS and 
	Android platforms, views, view models, localization and platform abstractions.</li>
	<li><strong>Mobile.iOS</strong> project contains IOS specific classes.</li>
	<li><strong>Mobile.Droid</strong> project contains Android specific classes.</li>
</ul>
<h3>Debugging</h3>
<h4>Host</h4>
<p>To start debugging Xamarin app you need to configure host settings. You can use 
either <b>Web.Mvc</b> or <b>Web.Host </b>to feed the Xamarin app.<br>
Open Windows Command Prompt. Go to the folder where your Web.Host or Web.Mvc csproj 
file is located.<br>
Then run the commands below to start hosting your Web Api.</p>
<pre lang="xml">SET ASPNETCORE_ENVIRONMENT=Development
SET ASPNETCORE_URLS=http://*:22742
dotnet run</pre>
<p>In order to every time write these lines, you can download the batch file below 
and run it to host your web api.</p>
<pre style="width:210px"><a href="https://github.com/aspnetzero/documents/tree/master/doc/etc/start-host.zip">Download start-host.zip</a></pre>
<div class="bs-callout bs-callout-warning">
	<strong><i class="fa fa-warning"></i> Warning</strong>
	<div>
		Before running the batch file, open it in notepad and replace the Web.Host 
		or Web.Mvc directory path with yours!</div>
</div>
<p>After you successfully run the host or mvc project you will see the output as 
below;</p>
<strong>Host started successfully:</strong><br>
<img class="img-thumbnail" alt="Host Started" src="images/xamarin-host-started.png" /><p>
<strong>Mvc started successfully:</strong><br>
<img class="img-thumbnail" alt="MVC Started" src="images/xamarin-mvc-started.png" />
</p>
<div class="bs-callout bs-callout-warning">
	<strong><i class="fa fa-warning"></i>Warning</strong>
	<div>
		Do not start Web.Mvc or Web.Host project via Visual Studio. Default settings 
		of Visual Studio does not allow connections except localhost.</div>
</div>
<p><font color="#339933"><i class="fa fa-info-circle"></i> We have successfully started 
host. Now we can configure Xamarin app to connect this host.</font></p>
<h4>Debugging Xamarin App</h4>
<p>To start debugging you need to change the IP address in <b>DebugServerIpAddresses</b> 
class. In the below screen you see the IP address 192.168.1.39, this is the IP of 
host computer. If you host Web.Mvc or Web.Host from your computer then change this 
IP with your computer&#39;s LAN IP. <br>
If you host Web.Mvc or Web.Host from another computer then you have to change this 
IP address with that computer&#39;s IP address. </p>
<img class="img-thumbnail" alt="Debug IP Address" src="images/xamarin-debug-server-ip-address.png" />
<br>
<br>
<div class="bs-callout bs-callout-warning">
	<strong><i class="fa fa-warning"></i>Warning</strong>
	<div>
		When you publish your Xamarin app for production you need to change <b>DefaultHostUrl
		</b>in <b>ApiUrlConfig </b>class!</div>
	<img class="img-thumbnail" alt="Debug IP Address" src="images/xamarin-api-url-config.png" />
</div>
<h4>Debugging Android</h4>
<p>There are a few installation steps and configuration details required to install 
Xamarin.Android.</p>
<div class="bs-callout bs-callout-info">
	<strong><i class="fa fa-info-circle"></i>Information</strong>
	<p>To start debugging Android app, you have to install Xamarin.Android. It&#39;s <commit_msg>Added link about external kestrel access<commit_after><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link type="text/css" rel="stylesheet" href="bootstrap.min.css" />
<title>Xamarin Development Guide</title>
</head>

<body>

<style type="text/css">
div.image-container > p {
    margin-top: -5px;
    font-style: italic;
    font-size: small;
    font-weight: 300;
    }
</style>
<h3>Introduction</h3>
<p>Xamarin is a cross-platform UI toolkit that allows developers to efficiently 
create native cross platform user interface layouts.<br>
This document is intended to show how to setup a Xamarin development environment 
and introduce existing features and user interfaces on Asp.Net Zero Xamarin platform.
For an overview of the Xamarin installation and setup practices see
<a href="https://developer.xamarin.com/guides/xamarin-forms/getting-started/installation/">
Xamarin.Forms Requirements</a> and
<a href="https://developer.xamarin.com/guides/cross-platform/getting_started/installation/">
Installation</a>. <br>
For an overview of the Asp.Net Zero getting started see
<a href="Getting-Started-Core">Asp.Net Zero Getting Started.</a> The Asp.Net Zero 
Xamarin is only available for Asp.Net Core included Angular UI and Mvc UI.</p>
<h4>Prerequisites</h4>
<p>Following tools are needed in order to develop ASP.NET Zero Xamarin:</p>
<ul>
	<li><a href="https://www.visualstudio.com">Visual Studio 2017 v15.4.4</a>+</li>
	<li>MAC for IOS simulator</li>
</ul>
<p>Asp.Net Zero Xamarin applications can be written for the following operating 
systems:</p>
<ul>
	<li>iOS 8 or higher</li>
	<li>Android 4.0.3 (API 15) or higher (<a href="https://developer.xamarin.com/guides/xamarin-forms/getting-started/installation/#android">more 
	details</a>)</li>
</ul>
<h4>Android</h4>
<p>You should have the latest Android SDK Tools and Android API platform installed. 
You can update to the latest versions using the
<a href="https://developer.xamarin.com/guides/android/application_fundamentals/using-the-sdk-manager/">
Android SDK Manager</a>.</p>
<p>Additionally, the target/compile version for Android projects <strong>
<span style="font-weight: 400">must</span></strong> be set to <b><em>Use latest 
installed platform</em></b>. However the minimum version can be set to API 15 so 
you can continue to support devices that use Android 4.0.3 and newer. </p>
<p>These values are set in the <strong>Project Options</strong>:</p>



<ide name="vs" class="ide-show">

<p><strong>Project Options &gt; Application &gt; Application Properties</strong></p>
</ide>

 
<img class="img-thumbnail" alt="Xamarin Android Options" src="images/options-android-vs-sml.png" />
<h4>Mac System Requirements</h4>
<p>You can use Visual Studio for Mac to develop Xamarin.Forms apps on OS X El Capitan 
(10.11) or newer. To develop iOS apps, it is recommended having at least the iOS 
10 SDK and Xcode latest installed.</p>
<h4>Windows System Requirements</h4>
<p>Xamarin.Forms apps for iOS and Android can be built on any Windows installation 
that supports Xamarin development. A networked Mac is required for iOS development.
</p>
<h4>Solution Structure (Layers)</h4>
<p>After you <a href="/Download">download</a> your project, you will see 3 types 
of solutions;</p>
<ul>
	<li><strong>.Mobile</strong> Xamarin and related projects included.</li>
	<li><strong>.Web</strong> Web and related projects included.</li>
	<li><strong>.All</strong> All the projects included.</li>
</ul>
<p>For Xamarin development, you can open <b>.Mobile.sln</b>.</p>
<div class="image-container">
   
   <img class="img-thumbnail" alt="ASP.NET Zero Xamarin Architecture" src="images/xamarin-architecture.png"/>	
	<p>Xamarin Architecture</p>
</div>
<div class="image-container">
	<img class="img-thumbnail" alt="ASP.NET Zero Mobile Solution" src="images/mobile-solution-overview.png"/>
	<p>Mobile Solution</p>
</div>
<p>There are 6 projects in the mobile solution:</p>
<ul>
	<li><strong>Core.Shared</strong> project contains basic primitive types like consts, enums that
	used in all layers of the solution.</li>
	<li><strong>Application.Shared</strong> project contains data transfer objects 
	(DTOs) and interfaces of application services shared with application layer 
	of the backend.</li>
	<li><strong>Application.Client</strong> project contains Web Api client (bridge 
	between mobile app and host) and proxy classes of Application Services.</li>
	<li><strong>Mobile.Shared </strong>project houses the code shared by IOS and 
	Android platforms, views, view models, localization and platform abstractions.</li>
	<li><strong>Mobile.iOS</strong> project contains IOS specific classes.</li>
	<li><strong>Mobile.Droid</strong> project contains Android specific classes.</li>
</ul>
<h3>Debugging</h3>
<h4>Host</h4>
<p>To start debugging Xamarin app you need to configure host settings. You can use 
either <b>Web.Mvc</b> or <b>Web.Host </b>to feed the Xamarin app.<br>
Open Windows Command Prompt. Go to the folder where your Web.Host or Web.Mvc csproj 
file is located.<br>
Then run the commands below to start hosting your Web Api.</p>
<pre lang="xml">SET ASPNETCORE_ENVIRONMENT=Development
SET ASPNETCORE_URLS=http://*:22742
dotnet run</pre>
<p>In order to every time write these lines, you can download the batch file below 
and run it to host your web api.</p>
<pre style="width:210px"><a href="https://github.com/aspnetzero/documents/tree/master/doc/etc/start-host.zip">Download start-host.zip</a></pre>
<div class="bs-callout bs-callout-warning">
	<strong><i class="fa fa-warning"></i> Warning</strong>
	<div>
		Before running the batch file, open it in notepad and replace the Web.Host 
		or Web.Mvc directory path with yours!</div>
</div>
<p>After you successfully run the host or mvc project you will see the output as 
below;</p>
<strong>Host started successfully:</strong><br>
<img class="img-thumbnail" alt="Host Started" src="images/xamarin-host-started.png" /><p>
<strong>Mvc started successfully:</strong><br>
<img class="img-thumbnail" alt="MVC Started" src="images/xamarin-mvc-started.png" />
</p>
<div class="bs-callout bs-callout-warning">
	<strong><i class="fa fa-warning"></i> Warning</strong>
	<div>
		Do not start Web.Mvc or Web.Host project via Visual Studio. Default settings 
		of Visual Studio does not allow external connections. For more info you can read <a href="https://weblog.west-wind.com/posts/2016/Sep/28/External-Network-Access-to-Kestrel-and-IIS-Express-in-ASPNET-Core">External Network Access to Kestrel and IIS Express in ASP.NET Core</a></div>
</div>
<p><font color="#339933"><i class="fa fa-info-circle"></i> We have successfully started 
host. Now we can configure Xamarin app to connect this host.</font></p>
<h4>Debugging Xamarin App</h4>
<p>To start debugging you need to change the IP address in <b>DebugServerIpAddresses</b> 
class. In the below screen you see the IP address 192.168.1.39, this is the IP of 
host computer. If you host Web.Mvc or Web.Host from your computer then change this 
IP with your computer&#39;s LAN IP. <br>
If you host Web.Mvc or Web.Host from another computer then you have to change this 
IP address with that computer&#39;s IP address. </p>
<img class="img-thumbnail" alt="Debug IP Address" src="images/xamarin-debug-server-ip-address.png" />
<br>
<br>
<div class="bs-callout bs-callout-warning">
	<strong><i class="fa fa-warning"></i>Warning</strong>
	<div>
		When you publish your Xamarin app for production you need to change <b>DefaultHostUrl
		</b>in <b>ApiUrlConfig </b>class!</div>
	<img class="img-thumbnail" alt="Debug IP Address" src="images/xamarin-api-url-config.png" />
</div>
<h4>Debugging Android</h4>
<p>There are a few installation steps and configuration details required to install 
Xamarin.Android.</p>
<div class="bs-callout bs-callout-info">
	<strong><i class="fa fa-info-circle"></i>Information</strong>
	<p>To start debugging Android app, you have to install Xamarin.Android. It&#39;s 
{'fraction_non_alphanumeric': 0.13539651837524178, 'fraction_numerical': 0.012229362950021838, 'mean_word_length': 4.910029498525073, 'pattern_counts': {'":': 0, '<': 463, '<?xml version=': 0, '>': 465, 'https://': 13, 'lorem ipsum': 0, 'www.': 6, 'xml': 4}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1192115', 'n_tokens_mistral': 5242, 'n_tokens_neox': 5052, 'n_words': 1719}