Some Tips for the Xamarin Challenge

Some Tips for the Xamarin Challenge

We launched the Xamarin Challenge two weeks ago, and like many of you, I’ve used this as a great excuse to learn the Xamarin developer experience. Here are a few general tips.

Note: I had hoped to be further along by now, but last week’s trip to Germany put a crimp in my plans. But I’m back up and running now.

Windows Intelligence In Your Inbox

Sign up for our new free newsletter to get three time-saving tips each Friday — and get free copies of Paul Thurrott's Windows 11 and Windows 10 Field Guides (normally $9.99) as a special welcome gift!

"*" indicates required fields

This field is for validation purposes and should be left unchanged.

General tips

Follow instructions carefully. Obvious, I know, but if you miss a crucial step, nothing is going to work.

Review the feedback in the Xamarin Challenge forum post. There is a lot of great feedback in the Xamarin Challenge forum post, so be sure to look through that, and to interact with the folks who actually created the challenge.

Learn Visual Studio, understand the terminology. For those who are unfamiliar with Visual Studio as well as Xamarin, the challenge can be a bit, well, challenging. But this kind of immersive experience is also a great way to learn Visual Studio. For multi-project solutions like those you’ll create using Visual Studio, it’s important to remember that you can build, deploy, and debug the project at any time, and I actually recommend doing so more frequently than is indicated in the challenge documentation. You build (compile, essentially) the entire solution. But you deploy and debug on a specific platform (Android, iOS, or Windows) and should make that the StartUp Project before you do so.

Collapse that tree. In many of the steps in Part 1, you are importing content into specific folders in the Visual Studio solution (many of which you create). Each time you do so, the Solution Explorer directory “tree” will expand at the node you are making changes. To keep things visually cleaner, I recommend closing the nodes of this tree as you go, to keep from getting confused. For example, if you’re working in CoolBreeze (Portable), make sure CoolBreeze.Android, CoolBreeze.iOS, and CoolBreeze.UWP (Universal Windows) are all fully collapsed.

Close files you’re not using. Likewise, you will add new files to the Solution in Part 1, and will replace the content of files with content provided by the documentation. As you complete working in each file, save it and close it.

Namespaces matter. One mistake I made while testing things was to start other Visual Studio projects and then forget that the project names (and resulting namespaces) matter. So, for example, if you create a second project called CoolBreeze2 or whatever, and then paste in the code we provide in the instructions, you’re going to see errors because that project will have a different namespace (“CoolBreeze2”) than is expected (“CoolBreeze”). I’m embarrassed to say I wasted time on this before I figured it out.

Run the Android emulator. The first time you deploy the app to the Android emulator, it takes forever and a day to launch. I recommend running the emulator first so it’s ready to go when you’re ready to deploy and debug. You do so by opening the Android Emulator Manager by clicking this button in Visual Studio’s Android toolbar.

Be patient. Some of the operations you’ll perform are time-consuming, in particular deploying to the Android emulator (as noted above). So pay attention to the Visual Studio status bar (at the bottom) when you kick off building, deploying, or debugging. It takes a while sometimes.

Tips for specific exercises in Part 1

Exercise 1. Here, you’re just installing the proper components needed to use Xamarin with Visual Studio. Pay particular attention to the “Individual Components” page when you modify Visual Studio: There are a number of options you have to enable there as well.

Exercise 2. Deploy and debug the solution before adding assets and resources in Exercise 2, and make sure it works. Does so with both Android and UWP (Windows) configured as the StartUp Project. There’s nothing quite like see the apps come up for the first time, especially when you can do so without errors in Visual Studio.

Exercise 3. This exercise is all about getting custom art into the app, in the Start menu in Windows, or on the Android home screen, and on the app splash screen. You might try testing the app after Step 13 and then again after Step 16, to see the difference this makes.

Exercise 4. This exercise neatly demonstrates the magic of Xamarin: Most of the code you’re adding here is common across all of the app versions, so it’s added to the CoolBreeze (Portable) project. Note that when Exercise 4 concludes, you cannot build the solution, as you’ll get an error related to App.RegistrationCode not being defined. That is defined in the next exercise.

Exercise 5. Here, you add some user interface. And then …

Exercise 6. Here, you can build, deploy, and debug the app across the supported platforms again. You should be able to do so with no errors, though to be fair I had to redo this challenge several times before I was able to claim victory.

On to Part 2…

 

Tagged with

Share post

Please check our Community Guidelines before commenting

Conversation 12 comments

  • RonH

    Premium Member
    01 April, 2017 - 9:06 pm

    <p>Thanks for this Paul..</p>

  • scumdogmillionaire

    02 April, 2017 - 2:55 am
  • kzrystof

    02 April, 2017 - 8:08 am
  • siko

    02 April, 2017 - 8:48 am

    <p>The challenge so far seemed to be: Can you get all the tools and dependencies up and running?!</p><p><br></p><p>But, part 1 is done. How long do we wait for part 2? I have all sunday afternoon!</p>

    • lvthunder

      Premium Member
      03 April, 2017 - 2:23 pm

      <blockquote><a href="#94950"><em>In reply to siko:</em></a></blockquote><p>You have to wait 72 hours between parts.</p>

  • David Melinosky

    02 April, 2017 - 3:11 pm
  • MacNala

    03 April, 2017 - 10:54 am

    <p>I started the Xamarin challenge before I fully realised the extent of the projects. I do not have any smartphone so the resulting app is meaningless to me. The amount of work involved with understanding Visual Studio is far too much, a more interesting challenge would be to develop a Visual Studio desktop application first. Then I might be in a position to understand what it is all about.</p><p>So I have abandoned the challenge and the hope of winning a Studio.</p><p>Good luck to all who work at it.</p>

  • Dan Hartwigsen

    Premium Member
    03 April, 2017 - 11:22 pm

    <p>Thank you for this article, Paul. I really just joined this challenge to get familiar with Visual Studio. I think I will wait to start Part 2 until you post your follow up article. ?</p>

Windows Intelligence In Your Inbox

Sign up for our new free newsletter to get three time-saving tips each Friday

"*" indicates required fields

This field is for validation purposes and should be left unchanged.

Thurrott © 2024 Thurrott LLC