Translate

Friday, February 9, 2018

Developer tips - Visual Studio - workarounds

Ok, let me start with I didn't choose to use Visual Studio !!  😛
But sometime is the pain that choose you.

In my case I'm using Visual Studio 7.4 on a Mac in order to develop apps Android and iOS in C# (old Xamarin).

This article contains some tips I discovered that can be useful if somebody else has the pain to use 'that'.
Of course this article is working in progress, expect updates.




It is assumed in this article :
  • to use a Mac with macOS High Sierra Version 10.13.3
  • to use the latest Visual Studio for Mac (7.4 as writing) kept update
  • to have a solution for Android and iOS

Updating

Updating Visual Studio and the NuGet packages of a solution is probably the most annoying and painful thing you have to do with Visual Studio.
Here some problems and suggested solutions.
Note ! The fact the solution worked for me DOES NOT guarantee will work for you !
I suspect Microsoft tailor the pain experience monitoring your DNA !!

Build fails immediately

If after an update nothing seems to work, ending up with errors that even block at the beginning the build, try this procedure :
  • Clean the buildings (Build/Clean All)
  • Close Visual Studio
  • Open Finders and go in your project
    • Locate the Android directory
    • Erase the obj and bin directory
    • Locate the iOS directory
    • Erase the obj and bin directory
  • Re-launch Visual Studio
  • Build all (Build/Build all)
This should regenerate the bin and obj directories in the Android and iOS and  build everything with no errors.

In my case happened updating Xamarin.Forms of the solution to the version 2.5.0.122203.

Emulators

Android - Execution failed


Sometime there are strange problems with the emulators, especially Android.
If when trying to run the code over an Android emulator a laconic "Execution failed" is the only error you receive, just launch manually the emulator.
Visual Studio is supposed to start the emulator if is not running, but not always is doing that.
So before to go in panic mode and Klingon insult mode, just start the damn emulator manually.

There is a nice plug in called  Emulator Manager (under Tools), I strongly suggest to install it.
Helps to facilitate to create/run/stop an Android  emulator manually.


No comments:

Post a Comment