user441521
user441521

Reputation: 6998

The type or namespace name 'Xamarin' could not be found in the global namespace

I just downloaded Xamarin (for windows). Created a new C#/Mobile Apps/Blank App (Xamarain.Forms Portable) solution. Tried to compile (I made no changes) and I get the error:

The type or namespace name 'Xamarin' could not be found in the global namespace

I guess I would expect this to compile out of the box so not sure why it's not.

namespace HelloWorld.Droid
{
    [Activity (Label = "HelloWorld.Droid", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity // this is the line that is erroring out on
    {
        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            global::Xamarin.Forms.Forms.Init (this, bundle);

            LoadApplication (new App ());
        }
    }
}

Upvotes: 4

Views: 9320

Answers (2)

Shafeeq
Shafeeq

Reputation: 59

Just add Xamarin.Forms from Tools -> NuGet Package Manager -> Manage NuGet Package For Solution and search Xamarin.Forms and install into your project.

Upvotes: 1

Josh
Josh

Reputation: 12566

It sounds like you're missing your Xamarin.Forms packages.

Can you expand your Packages directory in the Solution Explorer, and see if it's in there?

When you first create a new project, it'll go fetch it using NuGet.

If you don't see anything there, you can right-click the Packages folder, then choose Add Packages, and search for Xamarin.Forms.

Installing that should fix your problem.

Upvotes: 3

Related Questions