Xamarin Studio中缺少类型或名称空间名称"Xamarin"的错误 [英] The type or namespace name 'Xamarin' missing error in Xamarin Studio
问题描述
我收到此错误:
"MyApp \ App.cs(7,7):错误CS0246:类型或名称空间名称'Xamarin' 找不到(您是否缺少using指令或程序集 参考?)(CS0246)".
"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)".
我正在使用Xamarin Studio通过Xamarin.Forms制作跨平台应用程序.每当我构建基本表单项目时,都会出现此错误,而且我也不知道为什么.
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.
我是Xamarin的新手.
I'm new in Xamarin.
这是app.cs的代码:
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,
},
};
}
}
}
推荐答案
MihaMarkic的帖子此处将我引向正确的答案.对于解决方案中的每个项目,您都需要执行以下操作:
MihaMarkic's post here led me to the right answer. For each project in your solution you'll need to do the following:
- 在解决方案"标签中选择项目
- 在顶部菜单中选择项目"
- 选择添加Nuget程序包..."
- 搜索"Xamarin.forms"
- 在该项目中添加"Xamarin.forms"
这是使它在Mac上运行的工作流程.我不确定那里的PC用户会采取什么确切步骤.
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.
这篇关于Xamarin Studio中缺少类型或名称空间名称"Xamarin"的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!