Xamarin Forms Gotchas

AppData\Local\Xamarin\Android.Support.v7… doesn’t exist or file corrupted

Delete all files in C:\Users\YOURUSER\AppData\Local\Xamarin\zips

The type or namespace name ‘App’ does not exist in the namespace ‘BeCarefulOfLongNamesApp’ (are you missing an assembly reference?)

Right click your solution > Manage NuGet packages > Updates > Update all Xamarin related packages for each project you have problems.

The “XamlCTask” task failed unexpectedly…

Clean and rebuild the solution after fixing errors or check if your path exceeds the maximum length (260 characters).

Can’t connect to Mac

  1. Enable Remote Login
  2. Install Xamarin Studio
  3. Install XCode and follow these steps



  • Install compiled images
  • Uninstall PostSharp visual studio extension
  • Reboot pc (last hope)
  • Install PostSharp visual studio extension

Tried to compile a project from work at home and got greeted by that message, i have installed the compiled images at work but not at home so i thought that was the problem, but you “can’t” get the prompt to install the images because it only shows when you compile.

Navigate to: C:\ProgramData\PostSharp\YOURVERSION\bin.Release\

And execute your respective postsharp.srv.exe. After that just reboot your pc and install the visual studio extension (if you uninstalled it) and hope for your project to compile.

Drawing a rectangle on monogame

I’ve been trying to get some information about drawing a single rectangle on monogame to no avail, too much information scattered and unfinished examples (and a lot of obfuscated exceptions on code).

First we need the starting position (I used the location where the user pressed and maintains pressed the left click):

_selectionInitialPosition = new Vector2(Mouse.GetState().X, Mouse.GetState().Y); // it’s set just once on left click press
Vector2 mousePosition = Extensions.GetMouseVector2(); // Current position, refreshes in every update call

Now we set the vertex points:

var vertexPositionColors = new[]
 new VertexPositionColor(
 new Vector3(_selectionInitialPosition.X, _selectionInitialPosition.Y, 0), Color.White),
 new VertexPositionColor(new Vector3(_selectionInitialPosition.X, mousePosition.Y, 0), Color.White),
 new VertexPositionColor(new Vector3(mousePosition.X, _selectionInitialPosition.Y, 0), Color.White),
 new VertexPositionColor(new Vector3(mousePosition.X, mousePosition.Y, 0), Color.White)

Then we get the “draw pattern” (From a to b, from b to c, etc):

var lineStripIndices = new short[] {0, 2, 3, 1, 0};

And heres the drawing part:

var basicEffect = new BasicEffect(graphicsDevice) // Used for drawing
 View = Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 1.0f), Vector3.Zero, Vector3.Up), // camera
 Projection = Matrix.CreateOrthographicOffCenter(0, graphicsDevice.Viewport.Width,
 graphicsDevice.Viewport.Height,0, 1.0f, 1000.0f) // Offset position
 PrimitiveType.LineStrip, vertexPositionColors,
 0, // vertex buffer offset to add to each element of the index buffer
 4, // number of vertices to draw
 0, // first index element to read
 4 // number of primitives to draw 

Here’s the result (white rectangle):