Tuesday, September 5, 2017

Standard Libraries are replacing Portable Class Libraries. Here is how to start using them in Xamarin Forms projects today.

To Start with create a new Xamarin forms app that uses a Portable Class Library

Since UWP will nor support .net Standard Libraries for a few months I would press cancel if you get the dialog asking what version of UWP you want to support.

Right click on the solution and select add new project. Add a class library (.net standard)

Now drag the files App.Xaml and MainPage.Xaml from the PCL to the new class library. You can also delete the file Class1.cs in the standard library we created.

Open the properties for the Standard class library and change the default namespace to be the same as the portable class libraries

Time to add a NuGet package to the standard class library. Microsoft.NetCore.Portability.Compatibility. This will help prevent some build errors

Remove the portable class library from the solution. Right click on the solution and select mange NuGet packages for the solution. Select Updates and find Xamarin Forms. Select the latest pre release and make sure the standard library is checked. The latest prerelease supports standard libraries

Right click on the standard class library and select edit csproj. Remove the following lines from the file.

Sunday, September 3, 2017

I have used the NoSql database Lex.DB in some of my mobile apps in the past. The DB was actually very handy and it worked on Xamarin.iOS, Xamarin.Android, Windows phone 8+, UWP, PCL, Silverlight, and WinRT+. I am in the process of converting the project to a standard library 2.0 that you can use with net core, Xamarin, UWP when the fall creators update comes out in Oct 2017, and .net 4.6.1

My hope is to get the Database so it can be used in windows, linux, mac, xamarin, or UWP apps. This database is meant to be used with an app not as a server based NoSql database.

The code is currently in GitHub please report any bugs or feature requests there. Send me an email if you want to contribute to the project

In the MainActivity change the code in MainActivity to this. The code will create the database and add 5 monkeys to the database if there are not any records. I also changed the MainActivity to inherit from ListActivity so it show the items in the database is a list