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.

November 17

Podcast: Connect(); 2017 Xamarin and App Center Recap

In this episode of the Xamarin Podcast, I am joined by App Center program manager James White. We sit down and cover all of the amazing announcements from this years Connect(); 2017 event. Sit back, relax and get ready for tons of Xamarin goodness with Native Forms, .NET Embedding, App Center’s General Availability, and so much more! 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: Connect(); 2017 Xamarin and App Center Recap appeared first on Xamarin Blog.

November 15

Xamarin Forms on the Web

TLDR: I implemented a web backend for Xamarin Forms so that it can run in any browser. It achieves this without javascript recompilation by turning the browser into a dumb terminal fully under the control of the server (through web sockets using a library I call Ooui). This crazy model turns out to have a lot of advantages. Try it here!

A Need

I have been enjoying building small IoT devices lately. I’ve been building toys, actual household appliances, and other ridiculous things. Most of these devices don’t have a screen built into them and I have found that the best UI for them is a self-hosted website. As long as the device can get itself on the network, I can interact with it with any browser.

There’s just one problem…

The Web Demands Sacrifice

The web is the best application distribution platform ever made. Anyone with an internet connection can use your app and you are welcome to monetize it however you want. Unfortunately, the price of using this platform is acuquiecense to “web programming”. In “web programming”, your code and data are split between the client that presents the UI in a browser and the server that stores and executes application data and logic. The server is a dumb data store while the client executes UI logic - only communicating with the server at very strategic points (because synchronization is hard yo). This means that you spend the majority of your time implementing ad-hoc and buggy synchronization systems between the two. This is complex but is only made more complex when the server decides to get in on the UI game by rendering templates - now your UI is split along with your data.

Getting this right certainly is possible but it takes a lot of work. You will write two apps - one server and one client. You will draw diagrams and think about data state flows. You will argue about default API parameters. You will struggle with the DOM and CSS because of their richness in both features and history. You will invent your own security token system and it will be hilarious. The web is great, but it demands sacrifices.

(And, oh yes, the server and client are usually written in different languages - you have that barrier to deal with too. The node.js crew saw all the challenges of writing a web app and decided that the language barrier was an unnecessary complication and removed that. Bravo.)

Something Different

I was getting tired of writing HTML templates, CSS, REST APIs, and all that other “stuff” that goes into writing a web app. I just wanted to write an app - I didn’t want to write all this boilerplate.

I decided that what I really wanted was a way to write web apps that was indistinguishable (from the programmer’s perspective) from writing native UI apps. If I wanted a button, I would just new it up and add it to other UI elements. If I wanted to handle a click event, I wanted to be able to just subscribe to the event and move on. What I needed was a little magic - something to turn my simple app into the server/client split required by web apps.

That magic is a library I call Ooui. Ooui is a small .NET Standard 2.0 library that contains three interesting pieces of technology:

  1. A shadow DOM that gives a .NET interfaces to the web DOM. It has all the usual suspects <div>, <span>, <input>, etc. along with a styling system that leverages all the power of CSS.

  2. A state-synchronization system. This is where the magic happens. All shadow DOM elements record all the operations that have ever been performed on them. This includes changes to their state (setting their inner text for example) but also methods that have been called (for instance, drawing commands to <canvas>). This state can then be transmitted to the client at any time to fully mirror the server state on the client. With this system, all logic is executed on the server while the client renders the UI. Of course, it also allows for the client to transmit events back to the server so that click events and other DOM events can be handled. This is the part of Ooui that I am the most proud of.

  3. A self-hosting web server (with web sockets) or ASP.NET Core action handlers to make running Ooui very easy. If I want to self-host a button, I simply write:

var button = new Button { Text = "Click Me!" };
button.Clicked += (s, e) => button.Text = "Thanks!";

// Start a web server and serve the interactive button at /button
UI.Publish("/button", button); 

I can do this from any platform that supports .NET Standard 2. I can run this on a Mac, Linux, Windows, Raspberry PI, etc.

Alternatively, you can host it on an ASP.NET MVC page if you want it up on the internet:

public class HomeController : Controller
    public IActionResult Index()
        var button = new Button { Text = "Click Me!" };
        button.Clicked += (s, e) => button.Text = "Thanks!";

        // Return interactive elements using the new ElementResult
        return new ElementResult(button);

Pretty neat huh?

But one more thing…

Xamarin.Forms Support

The DOM is great and all, but what do .NET developers really love when you get right down to it? XAML. This little serialization-format-that-could has become the standard way to build .NET UIs. Whether you’re writing a Windows, UWP, or mobile app, you expect there to be XAML support.

So I made XAML work on the web by implementing a new web platform for Xamarin.Forms. Now, any of your Xamarin Forms apps can run on the web using ASP.NET.

Xamarin.Forms was not at all on my radar when I was building Ooui. Eventually though I realized that it was the perfect basis for a web version of Forms. I thought the idea to be a little silly to be honest - web developers love their CSS and I didn’t think there was much point. But one day I heard someone ask for just that feature and I thought “now we’re two”.

I had never written a backend for Xamarin Forms but found the process very straightforward and very easy given its open sourceness (e.g. I copied a lot of code from the iOS implementation :-)). There’s still a bit of work to be done but Xamarin.Forms and Ooui are getting along like long-lost cousins.

Animations work, pages and layouts work, styling works (as far as I have implemented), and control renders are currently being implemented. Fonts of course are an annoyance and cause a little trouble right now, but it’s nothing that can’t be fixed.

Once I got Xamarin Forms working on the web I realized how wrong I was for thinking this to be a silly technology. Writing web apps with the Forms API is a real pleasure that I hope you’ll get to experience for yourself.

Now that I am officially releasing Ooui, I want to work on a roadmap. But for now I mostly just want to hear people’s opinions. What do you think about all this? What are your concerns? How do you think you could use it? Do you think it’s as cool as I do? (Sorry, that last one is a little leading…)

Xamarin Announcements from Microsoft Connect(); 2017

Today, at Microsoft Connect(); 2017, we shared some very exciting updates related to Visual Studio and Xamarin. We invite you to join us tomorrow and Thursday to see even more during the remainder of the live event! Day 2 will be packed full of deep dives into the products, including those from Day 1, and Day 3 is a full day of free training from Xamarin University and Microsoft Virtual Academy.

Below are just a few Xamarin highlights from today’s announcements:

.NET Embedding

In Scott Guthrie’s keynote this morning, James Montemagno demonstrated an initial preview of our tooling to enable developers to integrate .NET libraries and UI written in C# into their existing iOS, Android, and macOS apps written in Objective-C, Swift, and Java. This opens a new path for developers to adopt Xamarin and .NET for code reuse across even more apps, without having to rewrite their existing codebase.

Your C# code is now more portable than ever: you can use C# to build cross-platform libraries that allow you to use C# and .NET in native iOS, Android applications, or the use of C# to build reusable components directly targeting iOS, Mac, or Android specific APIs.

.NET Embedding is available in preview for you to try today! Check out our getting started guides to add some .NET to your Objective-C, Java, and C-based apps.


Xamarin.Forms 2.5 is available today in the NuGet Gallery, delivering the latest quality and performance improvements, as well as new capabilities, including Native Forms and Layout Compression.

Xamarin.Forms Native Forms

With Native Forms, you can easily add cross-platform XAML pages to your Xamarin iOS and Android applications alongside existing storyboards and Android XML layouts, enabling you to use powerful Xamarin.Forms features such as XAML Compilation, DataBinding, and MessagingCenter, without having to go “all-in” on Xamarin.Forms navigation and the Xamarin.Forms app model.

Xamarin.Forms Layout Compression

Layout Compression optimizes the speed of UI rendering and memory consumption by enabling developers to identify which layouts may be flattened and removed from the visual tree without changing the resulting layout.

Xamarin.Forms & XAML Standard

To improve productivity for developers creating UI with Windows 10 XAML and Xamarin.Forms XAML, we have been working with the Windows team to bring these worlds closer together through the XAML Standard effort we talked about at Build earlier this year, making it easier to work with XAML regardless of which platform you’re targeting.

Today we’re announcing a Xamarin.Forms preview that features new standard APIs that align with APIs in UWP and WPF. These are aliases for common types available on all platforms you can target with XAML. What’s great is that these new APIs come without introducing breaking changes; you can start using these standard types in C# and XAML without changing any of your existing code.

Xamarin Live Player

Building UIs with Xamarin.Forms has become even easier in Visual Studio 2017 version 15.5 with the Xamarin Live Player. This release adds the ability to preview XAML in an Android emulator or an iOS simulator on a Mac live as you type, including support for rendering design-time data:


Previewing XAML with the Xamarin Live Player feels natural; as you move from document to document, Visual Studio will automatically preview the active XAML document for you. Entering “Live Run” mode to quickly iterate and see code changes reflected in your UI on device or simulator is as easy as pressing Shift+Alt+F5, or by clicking the “Live Run” button that appears at the top of the editor for XAML.

Live Player devices act and feel just like regular emulator and device debug targets. The Xamarin Live Player already supports breakpoints when debugging, and, in this release, we improved how the overall functionality integrates into Visual Studio, including integration with the Console and Error windows.

Open Sourcing Xamarin Workbooks

Last year we announced the general availability of Xamarin Workbooks, a free, interactive programming environment that’s perfect for experimentation, learning, and documentation. Since then, we’ve added support for the latest C# features, drastically improved NuGet integration, introduced support for .NET Core and Xamarin.Forms, and improved accessibility, performance, and user experience.

Today, we’re thrilled to announce that Workbooks is now open source under the MIT license and has moved to its new home under the Microsoft GitHub organization!

We see Workbooks as an invaluable educational tool for learning the myriad of .NET platforms, APIs, and libraries, and believe it can best grow in this role as an active open source project. Please check out the roadmap, chat with us in Gitter, and try our first open source release, Workbooks 1.4 Beta 1, available today.

We’re excited to share these great announcements. Be sure not to miss the live stream on Channel 9 to catch the next two days of awesome Xamarin developer content and LIVE sessions from Xamarin University trainers!

The post Xamarin Announcements from Microsoft Connect(); 2017 appeared first on Xamarin Blog.

Visual Studio App Center: The Next Generation of Xamarin Test Cloud

Today at Microsoft Connect(); we announced the launch of Visual Studio App Center, the next generation of Xamarin Test Cloud. App Center brings the power of Xamarin Test Cloud combined with ability to build, distribute, monitor and integrate push notifications- all in one place. Get all the features you use and love today in Xamarin Test Cloud combined with services you need to ship quality apps faster.

We know it’s important to deliver the highest quality experience on the latest platforms which is why App Center Test offers thousands of physical devices for you to deploy your tests to, each with different operating system installed. In addition to integration with App Center’s services, App Center Test introduces new features such as named device sets and improved API access.

New Features

Named Device Sets

To help you better organize and reuse collections of hardware from our lab, App Center test service adds named device sets. When you learn of your user’s most popular devices from App Center Analytics, you can close the loop by combining those devices into named collections for future testing. Named device sets helps you clearly understand which device collections we’re targeting when managing your upload command to execute tests in App Center.

Improved Device Selection

In addition to named device sets, you can now select all available devices in a single click for the most comprehensive test experience. We’ve also added text search to give users better accessibility to our vast hardware list.

Unified CLI

We’ve built a simpler, more powerful CLI for App Center Test. This improved experience gives you a unified command to upload your tests across all our supported automation frameworks.

Robust API

App Center Test adds a robust REST API giving increased access to all data generated during your test run. The information visible in your test report is accessible via our API including screenshots, device logs, test runner logs and failed device specifics.

Framework Support

App Center Test supports the most popular native and cross-platform UI testing frameworks including:

  • Espresso
  • XCUITest
  • Appium
  • Xamarin.UITest

We’re happy to announce all Xamarin Test Cloud subscribers will be upgraded to App Center Test within the next six months. More details regarding this upgrade coming soon.

Get started for free and give App Center a spin!

The post Visual Studio App Center: The Next Generation of Xamarin Test Cloud appeared first on Xamarin Blog.

Microsoft Connect(); 2017 Sessions for Xamarin Developers

Microsoft Connect(); 2017 is underway, and there will be a ton of great content for mobile developers over the next three days. To help ensure you catch it all,  we’ve compiled a list of the sessions you won’t want to miss!

Wednesday, November 15 | Keynotes & General Sessions

  • 11:15 am – 12:30 pm: Building the Intelligent Apps of the FutureSeth Juarez, Miguel de Icaza, and Scott Hanselman
  • 2:00 pm – 2:50 pm:
    • Build and Ship Apps Faster with C# and Visual Studio Mobile CenterNat Friedman
    • Application Modernization with Microsoft AzureCorey Sanders
  • 3:00 pm – 3:50 pm: Azure DevOps Simplified, Brian Harry
  • 4:00 pm – 4:50 pm: Developer Tools for App InnovationJulia Liuson


Thursday, November 16 | Live Technical Deep Dives

  • 11:00 am – 12:00 pm:
    • Tips and Tricks for Visual Studio IDE and Editor, Deborah Chen, Jordan Matthiesen, Sean McBreen
    • Microsoft Cognitive Services: Infusing Language and Speech Capabilities into Your Apps and Bots, Luis Carbrera-Cordon & Giampaolo Battaglia
  • 12:00 pm – 1:00 pm: A Day in the Life of a Modern .NET Developer, Scott Hunter
  • 4:00 pm – 5:00 pm: Ship Five-Star iOS, Android, Windows, and macOS Apps FasterBlanca Delgado Parra & Karl Piteria
  • 5:00 pm – 6:00 pm:
    • CI/CD DevOps Pipeline for Mobile Apps and ServicesDonovan Brown & Joshua Weber
    • Build Intelligent Apps, Andrew Liu
  • 6:00 pm – 7:00 pm:
    • Xamarin: The Future of App DevelopmentJames Montemagno
    • DevOps + SQLEric Klang
  • 7:00 pm – 8:00 pm: DevOps for Any Language and Any PlatformDonovan Brown & Jessica Deen


Friday, November 17 | Live Online Training

  • 11:00 am – 12:00 pm:
    • Azure: Bring Your App to the Cloud with Serverless Azure Functions, Jeremy Likness
    • Bring Speech to Your App by Using Custom Speech Service, James Carpinter
  • 12:00 pm – 1:00 pm: Azure: Building Applications Using Azure Service Fabric and ASP.NET Core, Vaclav Turecek
  • 1:00 pm – 2:00 pm: Build Cross-Platform Apps with Visual Studio, Xamarin, and .NET, Adrian Stevens & Mark Smith
  • 2:00 pm – 3:00 pm: Continuous Integration and DeliveryAdrian Stevens & Mark Smith
  • 3:00 pm – 4:00 pm: Connect Apps to the Cloud Using Xamarin and Azure, Adrian Stevens & Mark Smith
  • 5:00 pm – 6:00 pm: Get Started with .NET Standard 2.0, Ted Neward
  • 6:00 pm – 7:00 pm:
    • Zero to DevOps with Visual Studio Team ServicesAbel Wang
    • Building Planet Scale Apps with Real-Time PersonalizationAndrew Liu
  • 7:00 pm – 8:00 pm: Database DevOps for .NET Developers with SSDT and SQL Server 2017


On Demand Sessions

This year we’re also excited to be offering several on demand sessions that you can access at any time.

Don’t miss out—be sure to join us live November 15–17!

The post Microsoft Connect(); 2017 Sessions for Xamarin Developers appeared first on Xamarin Blog.

November 14

Webinar Recording | Build Better Games with Unity and Microsoft Azure

Join David Antognoli in this pre-recorded webinar and see how to take your Unity games to the next level with powerful cloud services. He walks through how to connect your apps to Microsoft Azure, adding compelling features that users love, like leaderboards and heatmaps, and demonstrates how new Unity and Visual Studio 2017 features improve your development process and your users’ experience.

In the session, you’ll learn how to:

  • Create and configure a new Unity project and integrate with Azure Easy tables from scratch.
  • Reference external packages from NuGet in Unity projects.
  • Update the Unity Mono security certificate store.
  • Add leaderboards and use the Azure Mobile Client SDK to save data telemetry.
  • Analyze heatmap telemetry to improve your game design.
  • Ask questions and receive guidance from our team of experts.


Love this video? Find more great Xamarin videos, including past webinars, conference sessions, and more, over on our YouTube channel.

The post Webinar Recording | Build Better Games with Unity and Microsoft Azure appeared first on Xamarin Blog.

November 13

Adding Sound to a Xamarin.Forms App

Audio has many uses in mobile applications. Sounds can be essential to your app; they may notify users of important events or make your app accessible to visually-impaired users. We can also use sound to help convey moods, intentions, or feelings within our apps. In fact, many companies include jingles or sounds as part of their brand.

Including audio in cross-platform apps means invoking platform-specific code. UWP, Android, and iOS all have powerful, but different APIs, to manage and play sounds. As cross-platform C# developers, we’d prefer a common API that can load audio data from a shared location.


The open-source SimpleAudioPlayer plugin provides a cross-platform C# API that can be used to load and play back audio in Windows UWP, Xamarin.Android, Xamarin.iOS, Xamarin.tvOS, and Xamarin.mac projects.

Xam.Plugin.SimpleAudioPlayer is available from Nuget.org. To get started, add the NuGet package to each platform-specific project you wish to support. If you’re using the plugin from a shared library such as a .NET Standard lib or PCL, add the package to the library.

You can add audio files to the platform-specific projects or to a shared library. If storing in the platform-specific projects, the files are expected to be in the standard locations. For Windows UWP and Android, place the files in the Assets folder with the Build Action set to Content and Android Asset respectively.

For iOS, macOS, and tvOS, place the audio files in the Resources folder and ensure the Build Action is set to BundleResource.

Audio files are then loaded by name:

var player = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current; 

When loading audio from a shared library, set the Build Action to Embedded Resource.

Files stored in a shared library are loaded into Stream before being loaded by the plugin:

var assembly = typeof(App).GetTypeInfo().Assembly; 
Stream audioStream = assembly.GetManifestResourceStream("YourSharedAssemblyName." + "yoursound.wav"); 
var player = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current; 

You start playback by calling the Play method.


SimpleAudioPlayer provides methods and properties to control audio playback, including the ability to stop, pause, seek, set volume, and set balance.

Playing Multiple Sounds Simultaneously

If you need to play more than one sound, the SimpleAudioPlayer plugin provides a factory method to create ISimpleAudioPlayer objects. Each object can load and play back audio independent of the others.

var alertSound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer(); 
var warningSound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer(); 
var clickSound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer(); 
var submitSound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer(); 

For an example of simultaneous playback, see the cross-platform Druminator sample app here.

SimpleAudioPlayer is open-source; if you’d like to request features, you can file an issue on GitHub, or better yet, make the changes and submit a pull request.

Further Reading

Xamarin and Xamarin.Forms have a fantastic plugin community. To find other great plugins, visit https://github.com/xamarin/XamarinComponents. You’ll even find other audio plugins to perform tasks such as converting text-to-speech and recording audio.

If you’re interested in learning more about the platform-specific APIs to playback audio, we have excellent documentation at developer.xamarin.com. To see how the Druminator app was built, watch the Xamarin University webinar here.

And to learn more about Xamarin development, be sure to check out our free courses available at university.xamarin.com. Better yet, sign up for a free trial to access all of Xamarin University’s Self-Guided Learning courses!

Discuss this post on the forums!

The post Adding Sound to a Xamarin.Forms App appeared first on Xamarin Blog.

November 12

This Blog is Being Moved

Future Mono Google Summer of Code posts will appear at


Don't miss our upcoming 2017 student contribution summary!

November 10

Replaying Replicated Redux

While property based tests proved to be a powerful tool for finding and fixing problems with ReactVR pairs, the limitations of the simplistic clientPredictionConstistenty mechanism remained.

It’s easy to think of applications where one order of a sequence of actions is valid, but another order is invalid. Imagine an application which models a door which can be locked: an unlock action followed by an open action should be valid, but an open action followed by unlock should be invalid given a starting state where the door is locked. It’s a lot more difficult to imagine how every ordering of this simple sequence of actions can be made either valid or invalid.

The limitation of clientPredictionConsistency is caused by the master client having to see an invalid action before it notices that clients need resyncing. An obvious way to avoid this limitation would be to have all other clients let the master know if they have seen an invalid action, but this solution becomes more complicated when you want to avoid the master sending duplicate sync actions if multiple clients report invalid actions simultaneously.

At this point, I took a step back: even if clients could report conflicts without duplicate resyncs, the improved clientPredictionConsistency would centralise conflict resolution in the master. Clients receiving a state sync action would have no context on the conflict and so would be unable to do anything more than reset their local state. Reusing the state sync mechanism which allows late joining is simple, but doesn’t allow anything more than effectively rejoining.

One of the nice things about Redux actions is that they are more meaningful than either UI events or state updates: it would be nice if clients could use the context they have in the actions to resolve conflicts and reconcile optimistic updates with authoritative actions gracefully. This made me think of the optimistic update mechanism used by Half Life which keeps a list of actions which have been predicted locally and reapplies the predictions to new states received by the server. Redux was built to easily support this kind of time travel through application history, so I wondered whether something similar could be built for replicated redux.

Some hacking on these ideas produced replayConsistency: a generalisation of the Half Life optimistic update ideas applied to arbitrary Redux actions. When a non-master client generates a valid local action it is sent to the master, immediately reduced locally, but also appended to a list of predicted actions. When the client recieves a new action from the master it rewinds the state back to the start of the prediction, applies the new master validated action and then reapplies the predicted actions if they are still valid. Eventually every predicted action becomes part of the total ordering defined by the series of actions validated by the master and is sent back to the client, or the state which caused the prediction to be invalid on the master is reached on the client. In either case the prediction is discarded. In the case where a prediction becomes invalid, the client has the state before the prediction, the master validated action and the list of predicted actions available when updatePredictions is called. This context allows the client to do something significantly more sophisticated to fix the local state than simply reseting the entire local state. In fact replayConsistency does not need to send state syncs at all, making it significantly more efficient than clientPredictionConsistency which I renamed resyncConsistency to make the differences between the two optimistic consistency policies clear.

Switching out resyncConsistency for replayConsistency and eyeballing several games of ReactVR Pairs suggested that the new consistency mechanism was working as intended, but finding all of the kinks in resyncConsistency had required testing thousands of sequences of actions using property based tests. My existing tests didn’t apply here: they made sure that an application would work given the limitations of resyncConsistency. The property I really wanted to ensure held for all consistency mechanisms is that regardless of the predictions made at each client, eventually all clients would be consistent.

This test generates a sequence of pairs actions which might be sent by the master or one of two non-master clients and then checks that all clients are eventually consistent even in the pathological case where each non-master predicts all of its actions before getting any actions from the master. A nice feature of this test is that it is independent of the consistency mechanism and so the same test can be run to ensure that both resyncConsistency and replayConsistency result in all clients being eventually consistent for thousands of sequences of actions.

With my tests passing I had high confidence that replayConsistency was working and didn’t impose any limitations on event ordering making it a much more general and efficient solution than resyncConsistency as well as much easier to use as it doesn’t require complicated reasoning about application event ordering. The potential to perform sophisticated application specific state reconciliation when predictions are invalidated is also interesting and I’m excited to see what we can do with it in future.

If you’d like to play the ReactVR version of pairs or see the rest of the code, it’s available on github here.

All code in this post is made available under the ReactVR examples license.

.NET Standard Comes to Xamarin.Forms Project Templates!

.NET Standard is a formal specification of the .NET APIs that allow you to share even more code across the platforms you target. Xamarin developers are able to use .NET Standard libraries for sharing business logic, and .NET Standard support came to Xamarin.Forms recently, allowing you to easily share both your business and UI logic across multiple platforms. You’ve been asking us when you can File -> New -> Mobile App with Xamarin.Forms and .NET Standard, and we’re excited to share that this is now available in the Visual Studio 2017 version 15.5 Preview 3.

In this blog post, you’ll learn how to use new project templates in Visual Studio 2017 that enable you to utilize .NET Standard as a code sharing strategy when creating new Xamarin.Forms apps. We’ll also take a look at some of the other improvements that landed in our Xamarin.Forms templates in Visual Studio 2017 version 15.5, such as migration to PackageReference and checkboxes for selecting which platforms to target.

File -> New Project

You can get started with a new Xamarin.Forms app by going to File -> New -> Visual C# -> Cross-Platform -> Cross-Platform App. This template allows you to select what kind of starter project you’d like, what platforms you plan on targeting, and your code sharing strategy.

File -> New Project -> Mobile App

.NET Standard

.NET Standard is a formal specification of .NET APIs that are intended to be available on all .NET runtimes (such as .NET Framework, Mono, and .NET Core). In real terms, you can think of this as a simplified, yet expanded, Portable Class Library. Any code added to a .NET Standard library can be used on any runtime that supports the .NET Standard Platform. In addition, we get expanded access to APIs within the .NET base class libraries (.NET Standard 2.0 adds over 20,000 new APIs!), support more platforms, and we don’t ever have to deal with the madness that is PCL profiles.

To use the .NET Standard code sharing strategy with Xamarin.Forms, select the .NET Standard radio button. Portable Class Library is no longer available as an option from File -> New, but existing class library projects will continue to build and work!


.NET developers know the pain that is packages.config. This file is meant to be a canonical list of all NuGet packages referenced by an app, but quickly turns into an unmanageable mess. The problem with packages.config is that it’s not just a list of all the packages explicitly added, but also the packages my packages reference.

PackageReference is a new way to manage your NuGets directly in the .csproj file, rather than a separate file. One of my favorite things about PackageReference is that all packages listed are transitively restored, meaning that you only need to define the top-level NuGets that your app consumes; no more dealing with the 100s of packages that your packages reference.

To manage packages, you can use the NuGet Package Manager or directly edit your .csproj to add something like this:

    <PackageReference Include="Xamarin.Forms" Version="" />

All templates in our cross-platform app wizard now use PackageReference by default.

Pick Your Platform

Mobile developers often begin a project with certain platforms in mind. We wanted our File -> New Project to reflect that experience, so we added checkboxes to allow you to select which platforms you care about when creating mobile apps.

Wrapping Up

This blog post talked about how you can File -> New -> Mobile App with Xamarin.Forms and .NET Standard. We also covered some key improvements to our cross-platform templating wizard, including migration to PackageReference and target platform checkboxes for selecting which platforms you care about.

You can get these changes today by downloading Visual Studio 2017 version 15.5, currently in preview. With Visual Studio 2017, it’s now easier and safer for you to try new Xamarin previews. Visual Studio 2017 Preview installs side-by-side with Visual Studio 2017, and is sandboxed to prevent anything in your preview environment from affecting your stable environment, so be sure to give our new templates a try today! These templates are Visual Studio-only for the moment, but will be making their way to Visual Studio for Mac sometime soon.

You can send feedback to @piercebogganor @xamarinhq on Twitter.

Discuss this post on the Xamarin Forums.

The post .NET Standard Comes to Xamarin.Forms Project Templates! appeared first on Xamarin Blog.

nodata: the secret sauce of lighter clones

Having local repos (working distributed) is great: super-fast checkins, speed-of-light branch creation... nothing breaks the flow. In contrast, slow checkins to a remote server simply get on my nerves and drive me directly to productivity-killing time filling like checking conversations and forums on Slack.

Super big local repos with tons of history I never actually use are not good, though. Yeah, disk is cheap and all that, but 20GB local repos drive me crazy.

And, I'm connected to the internet while I code 99.9% of the time. Cant I just have lighter clones and grab the data from the central server on demand?

We have just introduced nodata replication. You only get the metadata and data is downloaded on demand from the central server.


November 9

Xamarin and Xamarin University Sessions at Microsoft Connect(); 2017

We invite you to join us for Microsoft’s annual Connect(); developer event, scheduled to stream live online November 15–17, 2017! Save the date now to ensure you don’t miss a minute of this free event, which will include the latest in open source technologies, Azure, Data, AI, DevOps, Visual Studio, Xamarin, cross-platform applications, and more!

Save the Date

Day 1 will feature exciting keynotes and deep dives from Executive Vice President Scott Guthrie, Corporate Vice President of Mobile Developer Tools Nat Friedman, Distinguished Engineer Miguel de Icaza, and more from industry innovators.

Day 2 will feature a full day of live technical deep dives, including Q&A. Two of the many exciting sessions that we think will be of particular interest to Xamarin developers are outlined below. For the full schedule and times, please see the Connect(); website next week.

  • Xamarin: Future of App Development | James Montemagno: Xamarin enables C# developers to become native iOS, Android, macOS, and Windows app developers overnight. In this session, learn how to leverage your existing .NET and C# skills to create iOS and Android mobile apps in Visual Studio with Xamarin. In addition to allowing you to write your iOS and Android apps in C#, Xamarin lets you reuse existing .NET libraries and share your business logic across iOS, Android, and Windows apps
  • Ship 5-star iOS, Android, Windows and macOS Apps Faster: Get Up and Running with CI/CD: App stores have never been more competitive, and users’ expectations have never been higher. App developers need to ship more frequently, at higher-quality, and with greater confidence. Whether you are building an Objective-C, Swift, Java, React Native, Xamarin apps, we will show how easy to manage your development lifecycle and start shipping 5-star apps.

We’ll wrap up on Day 3 with live online training from Channel 9 and Xamarin University, which you can learn more about below. The live broadcast kicks off on Wednesday, November 15 at 10 am ET. Don’t miss out—add a calendar reminder now!

Xamarin University at Connect;()

Xamarin University Shield LogoWe’re hosting five live streamed training sessions covering topics on mobile development using the Universal Windows Platform (UWP), Xamarin, Microsoft Azure, and Visual Studio Mobile Center. Look for the following sessions on Day 3:

  • Build a Windows 10 App That Runs Anywhere Using the Universal Windows Platform (UWP): Windows 10 runs on a wide variety of devices including desktop, mobile, Xbox, and IoT. Supporting multiple device types prior to Windows 10 meant creating and supporting multiple projects. UWP lets you create apps that can target multiple device types from a single code base. Join us to learn how to create a new UWP app that runs on multiple device families, while still being able to take advantage of the unique features of those devices.
  • Build Cross-Platform Apps with Visual Studio, Xamarin, and .NET: Learn how easy it is to build apps for iOS, Android, and Windows using C# and Visual Studio Tools for Xamarin. We’ll show you how to share your code with .NET Standard libraries and build both native UI that creates a unique presentation on each platform, and a shared UI with Xamarin.Forms. We’ll then look at how to run your code right from Visual Studio with Xamarin Live Player, emulators and even your own personal devices.
  • Connect Apps Using Xamarin to the Cloud with Microsoft Azure: Every mobile app should have a great cloud service back-end. Microsoft Azure provides a wealth of reliable services you can easily take advantage of with C# and .NET. This session will show you how to use some of these great features such as synchronized data storage and server-side logic processing.
  • Continuous integration and delivery with Visual Studio Mobile Center: Discover how to quickly get your app connected to continuous integration and deployment pipeline using Visual Studio Mobile Center. We’ll explore how to automate the entire app lifecycle to get your apps built, deployed, tested, and published faster no matter what language or tools are used to build your mobile or Windows app in.
  • Real-Time Feedback and User Engagement with Visual Studio Mobile Center: Use Visual Studio Mobile Center to better learn about your customers and improve customer engagement. In this session, we’ll focus on getting deeper understanding about the health of your app using powerful Analytics and Crash reporting. We’ll also look at improving customer engagement through targeted push notifications. Finally, we’ll see how to get more from your data by exporting your analytics results into Application Insights.


Save the Date

The post Xamarin and Xamarin University Sessions at Microsoft Connect(); 2017 appeared first on Xamarin Blog.

November 7

Android Oreo Notification Channels

One of the most important features introduced in Android 8.0 Oreo is notification channels. Notification channels make it possible for you to group notifications so that all notifications posted to a channel exhibit the same behavior. For example, you might have a notification channel that is intended for notifications that require immediate attention, and a separate “quieter” channel that is used for informational messages.

For example, have a look at the YouTube app that is installed with Android Oreo (tap Settings > Apps & Notifications > Notifications > Notifications and select YouTube from the list). The first screen (on the left) lists two notification categories: Download notifications and General notifications:

Screenshots of YouTube Notification Categories

Each of these categories is a notification channel: the YouTube app implements a Download notifications channel and a General Notifications channel. Tap Download notifications in the first screen, which displays the settings screen for the app’s download notifications channel (see second screen above). Notice that you don’t have absolute control over how your notification channels interact with the user; s/he can modify the settings for any notification channel on the device as seen in the screenshots above (however, you can configure default values, as I’ll describe below). In this screen, the user can modify the behavior of the Download notifications channel by doing the following:

  • Set the Importance level to Urgent, High, Medium, or Low, which configures the level of sound and visual interruption.
  • Turn the notification dot on or off.
  • Turn the blinking light on or off.
  • Show or hide notifications on the lock screen.
  • Override the Do Not Disturb setting.

The General Notifications channel (third screen) has similar settings. As these examples illustrate, the new notification channels feature makes it possible for you to give users fine-grained control over different kinds of notifications.

Should you add support for notification channels to your app? If you’re targeting Android 8.0, your app must implement notification channels. An app targeted for Oreo that attempts to send a local notification to the user without using a notification channel will fail to display the notification on Oreo devices. If you don’t target Android 8.0, your app will still run on Android 8.0, but with the same notification behavior as it would exhibit when running on Android 7.1 or earlier.

Creating a Notification Channel

To create a notification channel, do the following:

  1. Construct a NotificationChannel object with the following:
    • An ID string that is unique within your package. In the following example, the string com.xamarin.myapp.urgent is used.
    • The user-visible name of the channel (less than 40 characters). In the following example, the name Urgent is used.
    • The importance of the channel, which controls how interruptive notifications are posted to the NotificationChannel. The importance can be Default, High, Low, Max, Min, None, or Unspecified.

    Pass these values to the constructor:

    public const string URGENT_CHANNEL = com.xamarin.myapp.urgent;
    . . .
    string chanName = GetString(Resource.String.noti_chan_urgent);
    var importance = NotificationImportance.High;
    NotificationChannel chan = new NotificationChannel(URGENT_CHANNEL, chanName, importance);

    In this code example, Resource.String.noti_chan_urgent is set to “Urgent”.

  1. Configure the NotificationChannel object with initial settings. For example, the following code configures the NotificationChannel object so that notifications posted to this channel will vibrate the device and appear on the lock screen by default:

    chan.EnableVibration (true);
    chan.LockscreenVisibility = NotificationVisibility.Public;

  2. Submit the notification channel object to the notification manager:

    NotificationManager notificationManager =
    (NotificationManager) GetSystemService (NotificationService);
    notificationManager.CreateNotificationChannel (chan);

Posting to a Notifications Channel

To post a notification to a notification channel, do the following:

  1. Configure the notification using the Notification.Builder, passing in the channel ID to the SetChannelId method. For example:
    Notification.Builder builder = new Notification.Builder (this)
    .SetContentTitle ("Attention!")
    .SetContentText ("This is an urgent notification message")
    .SetChannelId (URGENT_CHANNEL);
  2. Build and issue the notification using the Notification Manager’s Notify method:
    public const int NOTIFY_ID = 1100;
    . . .
    notificationManager.Notify (NOTIFY_ID, builder.Build());

That’s it! You can repeat the above steps to create another notification channel for informational messages. For example, this second channel could, by default, disable vibration, set the default lock screen visibility to Private, and set the notification importance to Default.

For a complete code example of Android Oreo Notification Channels in action, see the NotificationChannels sample; this sample app manages two channels and sets additional notification options.

If you aren’t familiar with how to create notifications in Xamarin.Android, see Local Notifications and the Local Notifications Walkthrough.

Discuss this post in the Xamarin Forums

The post Android Oreo Notification Channels appeared first on Xamarin Blog.

EXCLUSIVE: Texas Massacre Hero, Stephen Willeford, Describes Stopping Gunman

To donate to the Sutherland Springs Baptist Church to help them recover from this tragedy, check out this GoFundMe campaign.

November 6

Simplified App Signing with Secure Files in Visual Studio Team Services

One thing I never want to worry about when building my apps is needing to remember where I stored my provisioning profiles, certificates, and keystores. Thanks to Visual Studio Team Services (VSTS), I no longer have to when I set up a full production pipeline with the new Secure File storage feature. In previous posts, I showed how easy it is to set up Continuous Integration for iOS and Android applications in VSTS and Team Foundation Server (TFS). In the past we had to store certificates in blob storage or check it into source control. Now, we can simply upload our certificates and install them temporarily on the build machine to sign our applications. Let’s take a look at this new feature below.

Uploading Certificates

In VSTS under Build & Release is a new section called Library. You can think of this area of VSTS as a place to create shared variables between all of your build definitions. Variable groups enable you to create a full set of shared public and private variables that can be used everywhere. This is nifty when you want to secure and encrypt passwords for your certificates or other API keys. The second section is secure files, which is where we can upload any files we need for signing our applications. In this case, I’m building an iOS and Android application, so let’s upload our keystore, p12 certificate, and mobile provisioning profile.

iOS Signing

There are two new tasks that we can add to any build definition to install our certificate and our provisioning profile. These two tasks are special and will always run before any other task runs. For consistency, I added them to the top of my build definition.

We simply need to select the correct file to use and fill in the password in each task:

With these two tasks in place, we can now remove the old signing information from the Xamarin.iOS build task:

^^Leave these blank^^

Android Signing

Included in our build definition for Android is an Android Sign and ZipAlign task. We must upgrade this task to version 2.0 to use the new Secure File feature:

After that, we can select the keystore from the dropdown. That’s it! Our build is complete and our apps will continue to build without ever having to wonder where our certs are again.

Learn More

To learn more about Visual Studio Team Services and how you can start building out a full continuous integration, test, and deployment pipeline for any application, head over to VisualStudio.com. For a complete overview of Secure Files, head over to the official Microsoft Documentation.

Discuss this post on the forums!

The post Simplified App Signing with Secure Files in Visual Studio Team Services appeared first on Xamarin Blog.


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.