The type or namespace name 'Xamarin' missing error in Xamarin Studio

Hamza Khalil picture Hamza Khalil · Jun 2, 2014 · Viewed 80.4k times · Source

I'm getting this error:

"MyApp\App.cs(7,7): Error CS0246: The type or namespace name 'Xamarin' could not be found (are you missing a using directive or an assembly reference?) (CS0246)".

I'm using Xamarin Studio to make a cross platform app via Xamarin.Forms. Whenever I build the basic form project I get this error and I don't know why.

I'm new in Xamarin.

Here is the code of app.cs:

using System;
using Xamarin.Forms;             //This is the line where error occurs

namespace FIrstFormProject
{
    public class App
    {
        public static Page GetMainPage ()
        {
            return new ContentPage 
            {
                Content = new Label 
                {
                    Text = "Hello, Forms !",
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                },
            };
        }
    }
}

Answer

ebandersen picture ebandersen · Sep 2, 2014

MihaMarkic's post here led me to the right answer. For each project in your solution you'll need to do the following:

  1. Select the project in the Solution tab
  2. Select "Project" along the top menu
  3. Select "Add Nuget Packages..."
  4. Do a search for "Xamarin.forms"
  5. Add "Xamarin.forms" to that project

This is the workflow that got it working on my Mac. I'm not sure what the exact steps are for you PC users out there.