我刚刚下载了Xamarin(适用于Windows)。创建了一个新的C#/ Mobile Apps / Blank App(Xamarain.Forms Portable)解决方案。试图编译(我没有做任何更改),但出现错误:
The type or namespace name 'Xamarin' could not be found in the global namespace
我想我希望它可以立即进行编译,所以不确定为什么不是这样。
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 ());
}
}
}
听起来您好像缺少Xamarin.Forms包。
您可以Packages
在解决方案资源管理器中展开目录,然后查看它是否在其中?
首次创建新项目时,它将使用NuGet来获取它。
如果没有任何显示,可以右键单击Packages文件夹,然后选择Add Packages,然后搜索Xamarin.Forms
。
安装应该可以解决您的问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句