James Montemagno
James Montemagno

Live, Love, Bike, and Code.

Tags


James Montemagno

.Net Standard

Enabling C# 9 in Xamarin & .NET Standard Projects

Whoa! .NET 5 is out and C# 9 is out! This means you are ready to use records, new pattern matching, and more! But wait a second... your apps haven't been upgraded to .NET 5 yet or are a project type that don't support .NET  so you don't have access to the new C# 9 features :( Or do you!?!?!?! Yes, of course you do! Most new features in C# are compiler based and not necessarily runtime based.  When you create a new project the compiler determines a default C# language based on these r…

James Montemagno James Montemagno

Use C# 8 In Any .NET Project Today

C# 8 was officially released in September at .NET Conf along side .NET Core 3 & Visual Studio 16.3 (8.3 on Mac). It is packed with tons of amazing new features [https://docs.microsoft.com/dotnet/csharp/whats-new/csharp-8?WT.mc_id=docs-montemagnoblog-jamont] that truly everyone should be using. However, there is a lot of confusing as to if you can actually use C# 8 if you aren't using .NET Core 3 or .NET Standard 2.1. * Short answer: YES! You can use it today. * Long answer: YES! Y…

James Montemagno James Montemagno

Add ASP.NET Core's Dependency Injection into Xamarin Apps with HostBuilder

Dependency injection(DI) and inversion of control (IoC), have been a recurring theme in questions that I have received over the last six years. Sometimes it is around using constructor injection(), simple service containers, and often around full frameworks such as Prism or MVVM Light. I will be honest with you, I have never been a fan of DI/IoC when building mobile apps. My main reason is that there has never been any official pattern or recommendations from Google or Apple (or Microsoft/Xamari…

James Montemagno James Montemagno

Optimizing Xamarin Apps & Libraries with the Linker

The Xamarin linker is one of the most important pieces of technology when building mobile apps, that no one knows exists. It does all of the hard work for you, stripping out all unused code from libraries that you include in your apps. It should only be used in release mode as it takes extra time to compile your app, but means that your app will be smaller: The linker has specific implementations for both iOS [https://docs.microsoft.com/xamarin/ios/deploy-test/linker?WT.mc_id=docs-montemagno-…

James Montemagno James Montemagno

Super Simple Git Tagging & Releases in Azure DevOps

I am going to be honest with all of you, I never really understood Git tags [https://git-scm.com/book/en/v2/Git-Basics-Tagging] and releases inside of GitHub. In my old TFVC days I would just create a branch with the name of the release and call that my "tag" so I could always go back to it. What sparked my interest was seeing a bunch of popular projects that I was using combine tags with the GitHub releases. I started reading the documentation and still wasn't sold on it because I…

James Montemagno James Montemagno

Real Time Communication for Mobile with SignalR (Core)

Real Time Communication or RTC as the cool kids call it has always been a hot topic, especially for mobile. In normal mobile development when we wanted to get updates of data we would make a web request to a server, pull down data, and update our user interface. If you wanted to get bits of data on demand and in real time you would have to integrate WebSockets or some sort of push notifications to receive data as it is happening. However, it doesn't have to be anymore with the latest version…

James Montemagno James Montemagno

Multi-Targeting: Where Did My Files Go? Fixing .NET Core 2.1 SDK Issues

I love multi-targeting for creating libraries, and it is at the core of all of my plugins and Xamarin.Essentials. If you don't know what multi-targeting is don't worry as it is pretty rare that you would need to use it if you are creating apps. Most likely you will want to use multi-targeting in creating cross-platform libraries. In the past you would have to create multiple libraries for each target framework (such as iOS or Android) that you wanted to support if there was platform spec…

James Montemagno James Montemagno

Continuous Integration & Delivery for Xamarin & .NET Libraries with Azure DevOps (VSTS)

I build a lot of .NET libraries that include simple .NET Standard libraries to fully cross-platform plugins for Xamarin and Windows that target up to 10 different platforms. When I got started building libraries and shipping them to NuGet I went down a simple path of just building everything locally on my machine and manually uploading them to NuGet. This worked great for a single library, but as soon as I took on a second... third... forth... and so on, things got out of hand and I knew I had t…

James Montemagno James Montemagno