类型或名称空间名称“ Content”在名称空间中不存在

时间:2018-07-02 14:15:16

标签: c# android visual-studio monogame

我在Mac上的Visual Studio社区中创建了一个新的MonoGame Android解决方案,但我在Activity1.cs中未做任何更改,但始终收到以下错误消息:

LaunchMode = Android.Content.PM.LaunchMode.SingleInstance
  

名称空间中不存在类型或名称空间名称“ Content”   “ androtest.Android”(您是否缺少程序集引用?)(CS0234)

怎么了?我应该改变什么?

Activity1.cs的完整代码:

using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Views;

namespace androtest.Android
{
    [Activity(Label = "androtest.Android"
    , MainLauncher = true
    , Icon = "@drawable/icon"
    , Theme = "@style/Theme.Splash"
    , AlwaysRetainTaskState = true
    , LaunchMode = Android.Content.PM.LaunchMode.SingleInstance
    , ScreenOrientation = ScreenOrientation.FullUser
    , ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize)]
    public class Activity1 : Microsoft.Xna.Framework.AndroidGameActivity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var g = new Game1();
            SetContentView((View)g.Services.GetService(typeof(View)));
            g.Run();
        }
    }
}

0 个答案:

没有答案