Xamarin Studio 中的类型或命名空间名称“Xamarin"缺失错误 [英] The type or namespace name 'Xamarin' missing error in Xamarin Studio
问题描述
我收到此错误:
"MyAppApp.cs(7,7): 错误 CS0246: 类型或命名空间名称 'Xamarin'找不到(您是否缺少 using 指令或程序集参考?)(CS0246)".
"MyAppApp.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 的帖子 here 让我找到了正确的答案.对于解决方案中的每个项目,您需要执行以下操作:
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屋!