我刚下载了Xamarin (用于windows)。创建了一个新的C#/Mobile /Blank应用程序(Xamarain.Forms便携)解决方案。尝试编译(我没有做任何更改),我得到了错误:
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 ());
}
}
}
发布于 2015-03-12 18:05:56
听起来你好像错过了你的Xamarin.Forms包。
您能否在解决方案资源管理器中展开您的Packages
目录,并查看它是否在其中?
当您第一次创建一个新项目时,它将使用NuGet来获取它。
如果没有看到任何内容,可以右键单击Packages文件夹,然后选择Add,然后搜索Xamarin.Forms
。
安装应该可以解决您的问题。
发布于 2016-07-21 02:56:18
只需从Xamarin.Forms
中添加Tools -> NuGet Package Manager -> Manage NuGet Package For Solution
并搜索Xamarin.Forms
并将其安装到项目中即可。
https://stackoverflow.com/questions/29023464
复制