Microsoft, a few weeks ago, had a giant conference. //Build 2016! I watched the keynote with great interest. Anyone who knows me know that I’m a pretty good Microsoft apologist. I am not so far gone as to believe they can “do no wrong”, but I freely admit I often give them more than the benefit-of-the-doubt. I like to watch Build and Ignite and the other conferences and see how they are doing and try to get a clue as to what their vision of the future is.
There were 2 big announcements that got me very excited. 1) Microsoft Bot Framework announced. I’ll have a different blog post on that soon, but I dove in and spent a few hours making a bot of my own and had a great experience. (Mark my words, this tech is going to change the world) 2) Microsoft acquired Xamarin and is offering it for free.
For those of you unfamiliar, Xamarin is a programming language that allows you to re-use a great majority of your code across multiple deliverable (notably windows phone, android, and iOS). The dream is “Write you code once, and deploy to all 3 major mobile platforms”. I had some friend using a competitor, Phonegap, and had thought about using Xamarin before, but after the announcement I decided to dive in and see what I could do.
I downloaded and installed the Xamarin toolkit on both my Windows and Mac machines. Updated Visual Studio to the latest version. Opened a new Xamarin template, hit the compile button and the world exploded.
Over 15 hours later I learned some very important lessons.
1) Android – Do not update to the latest version of the nuget packages. There are about 6 different NuGet packages and they don’t sync well. Just remove everything, install Xamarin and hope (because sometimes it doesn’t) it gets all the dependencies right, and then DON’T TOUCH IT.
2) Universal Windows – After you add a new universal windows project to your xamarin project remember to tell your compiler to build it and deploy it (it doesn’t do this automatically).
Add a single line to the App.Xaml.Cs in the OnLaunched method after the Navigation Failed line – Xamarin.Forms.Forms.Init(e);
the MainPage.xaml need to be wrapped in a <forms:WindowsPage> instead of a <Page>
MainPage.xaml.cs needs a new LoadApplication
3) iOS – Visual Studio cannot launch the iOS simulator until the mac has launched it at least once. Open xcode, write a hello world, run it and debug it. After the simulator launches, then you’ll be able to launch it from VS.
4) Xamarin changes weekly (and probably even faster now that they are integrating with Microsoft). None of my lessons learned are guaranteed to work next week. . . or even tomorrow.
Maybe (maybe not) this will help someone else out there. But now my adventure officially begins. I have a project that compiles to all 3 phone types. Now to go actually write some code.