Disclaimer: this is an automatic aggregator which pulls feeds and comments from many blogs of contributors that have contributed to the Mono project. The contents of these blog entries do not necessarily reflect Xamarin's position.

May 24

Imitation Learning in Unity: The Workflow

With the release of ML-Agents v0.3 Beta, there are lots of new ways to use Machine Learning in your projects. Whether you’re working on games, simulations, academic or any other sort of projects, your work can benefit from the use of neural networks in the virtual environment. If you’ve been using ML-Agents before this latest […]

May 23

Guest Post: Securing and Versioning Xamarin Apps with Mobile.BuildTools

Dan Siegel is a Microsoft MVP, maintainer of the Prism Library, author of numerous dev tools and OSS libraries, leader of the San Diego Xamarin Dev’s Meetup, and a Xamarin blogger. Dan works as a Cross-Platform and Cloud Consultant at AvantiPoint and has a passion for DevOps and automation.


Writing mobile apps can be hard work. There is a long list of things to be set up for each project, in addition to the technical challenges that need to be overcome for the sake of security or to configure. The Mobile.BuildTools were born out of a desire to make DevOps easy and consistent to set up from one project to the next. The Build Tools aren’t just another library to install to your project, and they don’t add yet another dll that only adds to your final app size. Instead, they contain several tasks designed to make developing apps easier by training MSBuild to do some common DevOps tasks with some idea of whether you are building your app locally or on a CI Server. It also considers which CI Server you are building on for maximum efficiency.


Secrets are the very heart of the Build Tools. Nearly every app has some concept of a secret or at least something that should not be checked into source control. It could be your App Secret from AppCenter, your App’s Client Id for an OAuth provider, or perhaps it’s just the URL for the backend API. Regardless of what specifically the variable is for, injecting these variables with configuration files is not something you can do for Mobile like you could with a conventional desktop or web project. Trying to make it easier for other developers to work on the project, build the project in CI, and prevent the accidental check-in of an actual value being used by a developer on your team can be challenging.

Adding secrets to your app is as simple as adding a single JSON file to your project and then adding it to your .gitignore file. Even better is that secrets support string’s, bool’s, int’s and double’s opening up additional options of what you could potentially inject at build.




using AwesomeApp.Helpers;

namespace AwesomeApp
    public class Foo
        public void DoFoo()


    "SomeVar": "A Value",
    "SomeBool": true,
    "SomeInt": 1,
    "SomeDouble": 2.0

Build Server Secrets

The whole notion of adding a JSON file may sound nifty for local development, it is certainly an easy way to add constant values that you need in your code. At some point though your project won’t be built in your local environment where you can just add a JSON file. Instead, you will need to support it being built as part of a CI build perhaps in VSTS or AppCenter. Working with App Secrets in your projects couldn’t be easier in CI. By adding a variable prefixed with Secret_, the name following the prefix will be added to the JSON file, along with the value. Your Secrets class will be automatically generated without a single script as well.

App Manifests

Sometimes secrets go beyond code, and they are a problem that you need to deal with in an app manifest. A perfect example of this is when using the [AppCenter Distribution SDK], you must update your Info.plist to include a custom URL Scheme that contains your App’s AppCenter secret.



(Refer to Microsoft documentation App Center SDK -> Modify your Infoplist)

This can be easily overcome by tokenizing your manifests as shown here. Of course, this isn’t always practical to be developing with a tokenized Manifest as it could lead to an exception or you may have tokenized your Bundle Id. As a result, it opens up risks of accidentally checking in a value used during development. The solution is simple, exclude the manifest from source control, then place the tokenized version somewhere in your repo. The Build Tools will use conventions to locate your manifests and replace tokens from environment variables and then copy the missing manifest into your project. Similar to injecting Secrets, you simply need to add the prefix Manifest_ for the Build Tools to locate the value of the replacement.

Advanced Tasks & App Versioning

The Build Tools keep getting smarter. In fact, they are currently able to determine whether you are building on AppCenter, AppVeyor, Jenkins, or VSTS. For those brave enough to write create their own build tasks, you can benefit from this by conditionally executing some logic based on your build environment.

The Build Tools uses this understanding of your environment in a few ways. To start it will assist you by copying your Android APK, and your iOS IPA and dSYM to an Artifacts directory under your Solution root folder. This makes it easy to locate your build artifacts. Copying these artifacts to the same directory doesn’t always make sense though. For that reason, you’ll find that the Build Tools when determines the build environment is VSTS, it will automatically adjust the copy directory to $(Build.ArtifactStagingDirectory), and will disable the unnecessary task altogether on AppCenter.

Building Mobile Apps also means that you need to think about Versioning. The chances are unless you are a Library author, you probably don’t do much versioning. Versioning becomes critical though as you cannot submit version 1.0 to the AppStore multiple times. Automatic versioning though couldn’t be easier than with the Build Tools as you can set it up to version every single build, only local builds, or only builds on a CI Server. You can also choose between using the timestamp or you can prefer to use the build number. In order to enable Automatic Versioning, you simply need to add a property to your project with the version format you prefer. By default, every build will then get a version number.

AutomaticVersionOffset 0
AutomaticVersionEnvironment All
AutomaticVersionBehavior PreferBuildNumber or Timestamp


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>

SCSS for Xamarin Forms

CSS is undoubtedly one of the most powerful changes made to styling for XAML. While this is an exciting new enhancement to Xamarin.Forms, it also can quickly become hard to maintain on larger projects. The Build Tools provides an easy solution with bundled support for LibSass with SCSS stylesheets. Since LibSass is bundled there is no requirement that your machine needs Node or the Sass cli, it simply works by building your project. By using SCSS you get support for variables, functions and partial stylesheets making it easier to generate consistent styles in a manageable fashion.

The Xamarin.Forms CSS spec allows you to generate styles that apply to all elements of a given type as well as derived types by prefacing the type with ^. This isn’t actually valid CSS, and as a result, the LibSass compiler will not compile this. By updating your style as shown below to use either the ‘any’ or ‘all’ selector, you are able to write valid CSS and as a result, LibSass is able to compile to CSS. The Build Tools are then able to post-process the CSS to match the Xamarin.Forms spec.

Wrapping Up

It’s easy to get started with the Mobile.BuildTools. Head to GitHub to see a fully working demo built on AppCenter without a single build script. Check out the project ReadMe for more information on to set up custom configurations.

The post Guest Post: Securing and Versioning Xamarin Apps with Mobile.BuildTools appeared first on Xamarin Blog.

Sneak peek at Unite Berlin Keynote, full session schedule now available

Unite Berlin is a little over three weeks away! Festivities will start Tuesday, June 19th with sessions in the morning and the Unite Berlin Keynote at June 19, 6 pm CEST. The keynote will include announcements and demos presented by John Riccitiello, Isabelle Riva, Suhail Dutta, Timoni West and more, and news from the creators […]

May 22

Replicated Redux: The Movie

The recording of my recent React Europe talk about Replicated Redux is now online and I’ve written several other posts describing designing, testing and generalising the library if you would like to know more about the details. If you’d like to play the web version of pairs or see the rest of the code, it’s available on github here.

People often describe multi-user networked VR experiences as laggy, but code to hide latency by optimisticly predicting the effects of local actions is hard to write, difficult to test and often application specific. It feels great to have helped make this problem a little easier to solve for React developers by building Replicated Redux.

May 21

Calca in the Microsoft Store

Calca is my crazy symbolic math calculator/markdown editor designed specifically for mad scientists. Today, I am very pleased to announce that Calca 1.5 is available in the Microsoft Store!


This is exciting for me on two fronts.

First, this is a great update to the Windows version of Calca that includes plotting and high DPI support. Plots make it easy to visualize functions and calculate derivatives while the high DPI support just makes the app look good. This version also includes a large number of fixes and I hope you love it!

Second, and the point of this blog post, is the fact that the app is finally available in the Microsoft Store making it super easy for all Windows 10 users to try it.

This is a change from my previous distribution method of hosting the app on my own store. I never liked that approach for a variety of reasons - updates were hard, visibility is hard, users had to trust my payment processor, etc. etc. now that it’s in the Microsoft Store, I hope to reach more people and simplify the update process.

The trick was that I designed Calca for Windows to work on Windows XP and does not run on Microsoft’s UWP platform - previously a prerequisite to being in the store. The good news is that Microsoft is now allowing such apps in the store thanks to a program called Desktop Bridge.

If you’d like to hear more about it, please continue reading. Otherwise, you can go get a free trial to see if it’s for you.

All Hail the Desktop Bridge

Microsoft heard all us Win32 programmers begging to be the in Microsoft Store and launched “Project Centennial” - a great program with an insulting name. So they renamed it “Desktop Bridge” and all the world’s programmer’s rejoiced. With The Bridge, you can get your .NET WinForms apps into the Microsoft Store and onto millions of Windows 10 machines.

I’ll be honest, I’m still not sure what The Bridge is. The good news is, you can trust it without knowing what it is because it doesn’t modify your app. Instead, it wraps up your app’s executable and all its support files into a standard APPX package.

It’s as easy as downloading the DesktopAppConverter from the store and running this command in PowerShell:

DesktopAppConverter.exe -Installer C:\LocationOfAppAndDependencies -AppExecutable App.exe -Destination C:\DesktopAppConverterOutput -MakeAppx

Well, that’s the general idea. Unfortunately, the documentation for the converter is a bit sparse and it took me some trial and error to learn the full set of arguments you need to pass it to work. Most of these arguments simply match what’s displayed in the Microsoft developer hub - however they have slightly different names creating a bit of confusion. Incase you ever find yourself doing this, here’s a little guide:

-PackageDisplayName is the name of your app in the store. “Calca” for me.

-PackageName is generated by Microsoft and is something like “1B4DF00D.Calca”

-PackagePublisherDisplayName is you, but it better match the name in the developer hub. For Calca, it’s “Krueger Systems, Inc.”

-Publisher this is the GUID that Microsoft lovingly calls you in bed. “CN=X0X0X0X0-X0X0-X0X0-X0X0-X0X0X0X0X0X0″

-Version is in class 3-dot form: “″

Papers Please

Unfortunately, Desktop Bridge apps are still not fully supported by the Developer Hub UI. Instead, you are going to have to fill out some web mail template forms, wait a few days, do some other banal task, wait a few days, sign another agreement, wait a few days, you get the idea.

You will also get warnings about your app being special (I know!) and how certification will take a week instead of the usual couple hours on the store. This process also involves more emails and more clicking. It’s fun.

Overall, the process went very smoothly.

I was hoping for a more streamlined experience. None of this process is hard, it’s just very bureaucratic. And it does leave me wondering how much effort updates will be… but let’s not think about that!

A New Age for Updates

My biggest regret with selling Calca directly is that I didn’t establish a good update path for customers. My policy was “email me and I’ll send you an update for a year”. This policy is bad both for my customers (I’m making them use email!) and myself (now I have to read email!).

The net result of this was the Windows version of Calca was falling behind the Mac and iOS feature sets. Terrible!

Thankfully, now that the app is in a proper store, I can keep it up to date with iOS and Mac cousins.

That’s it! Thank you for reading and I hope you have fun doing some math!

DevOps with TeamCity

Previously, I explained how to implement a fully automated branch per task cycle with Bamboo to merge branches when certain conditions were met. Now, I will explain how to implement the same solution with TeamCity.

What I'm going to explain now is how to configure TeamCity to monitor Plastic SCM branches and directly merge them to main when certain conditions are met (when a certain value is assigned to an attribute or even certain status in the associated issue tracker).

In the example, I'm going to keep using Jira as issue tracker, but nothing prevents you from connect to any other issue tracking system.

Cycle described
Read more »

May 18

Startup Improvements in Xamarin.Forms on Android

With Xamarin.Forms 3.0 in addition to the many new feature work that we did, we have been doing some general optimizations across the board, from compile times to startup times and wanted to share some recent results on the net effect on one of our larger sample apps.

These are the results when doing a cold start for the SmartHotel360 application on Android when compiled for 32bits (armeabi-v7a) on a Google Pixel (1st gen).

Release Release/AOT Release/AOT+LLVM
Forms 2.5.0 6.59s 1.66s 1.61s
Forms 3.0.0 3.52s 1.41s 1.38s

This is independent of the work that we are doing to improve Android's startup speed, that both brings additional benefits today, and will bring additional benefits in the future.

One of the areas that we are investing on for Android is to remove any dynamic code execution at startup to integrate with the Java runtime, instead all of this is being statically computed, similar to what we are doing on Mac and iOS where we completely eliminated reflection and code generation from startup.

Faces of Unity: Andrew Maneri

Unity is made up of talented people, including artists, engineers, and project managers, whose work is as varied as their interests! Get to know who they are, what exciting projects they’re working on, and what drives them through the Faces of Unity Blog series. In our first post, we profiled Sarah Stumbo, a Producer on […]

May 16

Xamarin.Essentials: Cross-Platform APIs for Mobile Apps

When developing iOS and Android apps with Xamarin, developers can access every native platform API using C#. These bindings not only expose the platform APIs in C#, but add powerful C# features, such as async/await, events, delegates, and more. This is a huge advantage for developers, because they never have to leave C#, whether they’re writing shared business logic, user interface, or accessing native features. One key feature developers often look for when developing cross-platform apps with Xamarin is a way to access common native features from their shared code without having to write their own abstractions or find an open source plugin created by the community.

The dream of a single API to access features such as geolocation, sensors, secure storage, and more is now a reality for any application created with Xamarin with Xamarin.Essentials!

Xamarin.Essentials APIs

In our first preview, available today, Xamarin.Essentials APIs provide access to over 25 native features from a single cross-platform API library, which can be accessed from shared code no matter how the user interface is created. This means you can use Xamarin.Essentials APIs with a single Xamarin.Android app or a Xamarin.Forms app targeting iOS, Android, and UWP. Even though it’s packed with features, it’s still fully optimized for performance and minimal impact on app size, because the library takes full advantage of being linker safe. This means only the APIs and features you use will be included in your app and the rest will be removed when you compile your app.

The preview release, with the initial set of cross-platform APIs, can be installed in your apps through NuGet :

The initial set of APIs was based on feedback from Xamarin developers about what they wanted to see from a cross-platform API library. We will continue to add more over time.

Getting Started

It’s easy to start using Xamarin.Essentials APIs in any new or existing app in just a few easy steps:

  1. Open an existing project, or create a new project using the Blank App template under Visual Studio C# (Android, iPhone & iPad, or Cross-Platform).
  2. Add Xamarin.Essentials NuGet package to projects:
    1. Visual Studio: In the Solution Explorer panel, right click on the solution name and select Manage NuGet Packages. Search for Xamarin.Essentials and install the package into ALL projects including iOS, Android, UWP, and .NET Standard Libraries.
    2. Visual Studio for Mac: In the Solution Explorer panel, right click on the project name and select Add -> Add NuGet Packages…. Search for Xamarin.Essentials and install the package into ALL projects including iOS, Android, and .NET Standard Libraries.
  3. Add a reference to Xamarin.Essentials in any C# class to reference the APIs.

    using Xamarin.Essentials;

  4. Xamarin.Essentials requires small additional platform specific setup on Android projects to access specific features:

    Inside of the Android project’s MainLauncher or any Activity that is launched Xamarin.Essentials must be initialized in the OnCreate method:

    Xamarin.Essentials.Platform.Init(this, bundle);

    To handle runtime permissions on Android Xamarin.Essentials must receive any `OnRequestPermissionsResult`. Add the following code to all Activity classes:

    public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
        Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
        base.OnRequestPermissionsResult(requestCode, permissions, grantResults);

That’s it! You’re now ready to start using Xamarin.Essentials APIs in your app. Each API has been fully documented with code snippets that you can copy into your app.

Be sure to read to read our full Getting Started guide for additional details.

Build a Compass

During one of my sessions at Microsoft Build 2018 I showed how to combine Xamarin.Forms and Xamarin.Essentials APIs to build a cross-platform Compass in under 10 minutes. It’s as simple as adding a few images for the compass into the application and a small amount of user interface:

        <RowDefinition Height="*"/>
        <RowDefinition Height="Auto"/>

    <Image HorizontalOptions="FillAndExpand"

    <Image HorizontalOptions="Center"

    <Label Grid.Row="1"
           HorizontalOptions="Center" />

I was able to use the Compass API from Xamarin.Essentials in the code behind for this page in order to register for events when the compass changed and update text of the label and the image’s rotation in just a few lines of code:

using Xamarin.Forms;
using Xamarin.Essentials;

namespace MyCompass
    public partial class MainPage : ContentPage
		public MainPage()

            // Register for reading changes
            Compass.ReadingChanged += Compass_ReadingChanged;

        void Compass_ReadingChanged(CompassChangedEventArgs e)
            LabelInfo.Text = $"Heading: {e.Reading.HeadingMagneticNorth}";
            ImageArrow.Rotation = e.Reading.HeadingMagneticNorth;

        protected override void OnAppearing()

        protected override void OnDisappearing()

Just like that, a compass application is created! You can find the full source code and images on my GitHub.

What’s Next

Xamarin.Essentials has gone through rigorous testing, but we’re asking you to provide feedback during this short preview cycle. Please try out the library in your apps and report any issue that you may run into on the Xamarin.Essentials GitHub repository.

We see this library as a core fundamental piece of the Xamarin platform and know that it’s an essential building block for all developer and applications. As such, we will be integrating the Xamarin.Essentials NuGet package into every iOS, Android, and Xamarin.Forms template inside Visual Studio and Visual Studio for Mac, so developers have access to these APIs from the very beginning of their project.

See it Live

You can watch a full overview of Xamarin, Xamarin.Forms, and Xamarin.Essentials in my Building mobile apps with Visual Studio and Xamarin session from Microsoft Build 2018:

Xamarin University Guest Lecture

Join me on Thursday, June 7th 10:00 AM PST when I will host a LIVE guest lecture on Xamarin University covering all things Xamarin.Essentials in details and answering all questions. If you aren’t a Xamarin University subscriber simply sign up for a free account to get access to the guest lecture.




Learn More

You can browse through our full documentation that has a full overview of how to get started and how to use each and every feature of Xamarin.Essentials. We have also provided full API reference that can be fully browsed online to dive into the details of Xamarin.Essentials APIs.

The post Xamarin.Essentials: Cross-Platform APIs for Mobile Apps appeared first on Xamarin Blog.

Debugging Pending changes view performance

Plastic finds changes super-fast. We expect Pending changes to refresh in under two seconds and three to four seconds for bigger projects that have more than 90,000 files in a workspace. Note: The first time that you open it, it will take longer because of some caching and disk monitoring setup.

If your Pending changes is not performing that fast, there is something wrong.

Back in release, we added a performance warning in Pending changes when it detects that finding changes is slow. The warning includes a link to the documentation with performance recommendations:

This blogpost explains how to troubleshoot beyond the basics for what might be slowing down your Pending changes view.

Read more »

Join the 2018.2 beta and earn the chance to win great Unity gear

The Unity 2018.2 beta is up and running, and as an added bonus to getting to mess around with all the new features, we’re continuing the tradition of our beta sweepstakes. If you haven’t already read the blog about what’s new in the Unity 2018.2 beta, you can find it right here. The latest beta […]

May 15

Integrating Xamarin.com into Microsoft Sites

Over the past year we’ve started to make it even easier to find Xamarin information on Microsoft sites, and going forward you will start seeing changes to xamarin.com as we continue to migrate content over to Microsoft properties. Below is a summary of where to find key information you might be looking for:
Content that has already moved:

Content that is staying where it is for now:

We recommend updating your bookmarks so you can continue to easily find what you need.

The post Integrating Xamarin.com into Microsoft Sites appeared first on Xamarin Blog.

May 14

Update Your Xamarin.Mac Apps for 64-bit Today!

Last June, Apple announced that upcoming macOS releases would only support 32-bit applications “with compromises”. If your Mac application is not 64-bit, we strongly recommend taking action to avoid compromises in the next version of macOS.

Migration to Modern Xamarin.Mac

The most noteworthy update includes migrating your project to 64-bit. Older projects that are still using Xamarin.Mac Classic or MonoMac will need to be migrated to Xamarin.Mac Unified to support 64-bit. Visual Studio for Mac includes a migration wizard that will help automate many of the mechanical changes that are needed to update your Mac application. First, review any build warnings. Existing warnings may be pointing towards future issues and should be fixed prior to migration. Next, start the Migration Wizard from the Project > Migrate to Xamarin.Mac Unified API menu. The menu will not be visible if your application has already been migrated to Xamarin.Mac Unified (references Xamarin.Mac.dll).

After the automated migration wizard has finished, build your project to determine if additional changes are required. There were a number of API corrections made in Unified, and changes to your code may be required. More information can be found in the migration documentation.

The Journey to 64-bit

Xamarin.Mac Unified projects have support for building 64-bit binaries, but some existing and migrated projects may be building 32-bit instead. To verify your project’s settings, open the Project > Options menu and navigate to the Mac Build > Supported architectures setting. Select the x86_64 setting for 64-bit builds.

Moving from 32-bit to 64-bit may uncover a number of issues in your application, as it changes the size and alignment of data structures. This can affect custom P/Invoke invocations and native code linked in your application. Review any build warnings and test your application thoroughly to catch potential issues after updating.

Learn More

For additional information, visit our documentation on enabling 64-bit in your Mac applications.

Discuss this post on the Xamarin forums

The post Update Your Xamarin.Mac Apps for 64-bit Today! appeared first on Xamarin Blog.

Stripping scriptable shader variants

Massively reduce Player build time and data size by allowing developers to control which Shader variants are handled by the Unity Shader compiler and included in the Player data. Player build time and data size increase along with the complexity of your project because of the rising number of shader variants. With scriptable shader variants […]

May 12

Oculus Launch Pad 2018 is here!

Get the help you need to develop and bring your VR experience to market. Apply until May 20! Since 2016, Oculus has invited promising developers from underrepresented backgrounds to get hands-on coaching that helps them meet their VR development goals by joining the Launch Pad program. Apply by May 20 to join this diverse range […]

May 11

Podcast: Build 2018 Recap for Mobile Developers

In this episode of the Xamarin Podcast, James Montemagno and I discuss the news for mobile developers from Build 2018, including Xamarin.Forms 3.0, Hyper-V support for the Android emulator, Xamarin.Essentials, and updates to Visual Studio 2017 and Visual Studio for Mac.

Be sure to download today’s episode from your favorite podcast app!

Subscribe or Download Today

Keeping up with the latest in .NET, C#, and Xamarin is easier than ever with the Xamarin Podcast! Cohosts Pierce Boggan and James Montemagno cover topics relevant to Xamarin developers, from designing mobile apps to identity management. Be sure to subscribe to the Xamarin Podcast on iTunes, Google Play Music, Stitcher, or your favorite podcast app you use to ensure you don’t miss an episode.

The post Podcast: Build 2018 Recap for Mobile Developers appeared first on Xamarin Blog.

Unity at Microsoft Build: 7 takeaways from the show

The Microsoft Build 2018 developer conference just wrapped up in Seattle and Unity was there to learn about key announcements, talk about mixed reality development, and (for the first time) demo how PiXYZ unlocks CAD data for real-time development. Here are the top 7 takeaways from Microsoft Build. 1) Take CAD to mixed reality with […]


Monologue is a window into the world, work, and lives of the community members and developers that make up the Mono Project, which is a free cross-platform development environment used primarily on Linux.

If you would rather follow Monologue using a newsreader, we provide the following feed:

RSS 2.0 Feed

Monologue is powered by Mono and the Monologue software.