c# - Xamarin Studio 中的 Xamarin.Forms

标签 c# xamarin xamarin.forms xamarin-studio

我下载了 Xamarin Studio 来构建我的第一个应用程序,但我遇到了一些问题,我还没有找到解决方案。

首先,我使用 App Xamarin.Forms Blank 模板创建了一个新的解决方案。当我尝试构建它时,出现了一些错误(我没有更改模板中的一行):


The type or namespace name 'Xamarin' could not be found (are you mission a using directive or an assembly reference?)
The type or namespace name 'Application' could not be found (are you mission a using directive or an assembly reference?)

然后我假设 Xamarin.Forms 包丢失了,所以我点击了项目 > 添加 NuGet 包... 并尝试安装 Xamarin.Forms 包。这是我卡住的地方,因为显示了一个新错误:


Could not install package 'Xamarin.Forms 1.3.3.6323'. You are trying to install this package into a project that targets 'portable-Profile78', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

我将不胜感激任何帮助,因为我还没有找到任何解决方案。

最佳答案

错误消息表明您没有安装可移植类库 (PCL)。

如果您使用的是 Mac,则可以通过安装 Mono Development Kit (MDK) 来安装它们.

如果您使用的是 Windows,则该过程会有点棘手。要在 Windows 上安装可移植类库,您有以下三种选择:

  1. 安装 Visual Studio 2013(完整版或 Express 版)。需要更新 2 或更高版本。
  2. 安装 Portable Library ToolsPortable Library Reference Assemblies 4.6 .
  3. 安装可移植库工具并将 .NETPortable 目录从 Mono 复制到 Windows。

2. 的一个问题是安装 Portable Library Reference Assemblies 4.6 不会将它们安装到正确的位置,而只是将 PortableReferenceAssemblies.zip 文件安装到目录中:

C:\Program Files (x86)\Microsoft .NET Portable Library Reference Assemblies 4.6

此 PortableReferenceAssemblies.zip 文件包含三个目录(4.0、4.5 和 4.6),需要将其提取并复制到 PCLs 目录中:

 C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable

Installing Portable Class Libraries for Xamarin Studio 中有更多详细信息发布,但以上内容应该让您大致了解需要什么。

关于c# - Xamarin Studio 中的 Xamarin.Forms,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31455925/

相关文章:

c# - 在没有标题的工作簿中创建工作表 ace.oledb

android - ContextCompat.GetColor 不返回颜色

c# - 如何等待或知道 Xamarin Forms 中的多个动画何时完成?

macos - 面向 macOS 的 Xamarin.Forms

c# - 继续过滤/查询分组依据到对象?

c# - 如何在 ASP.NET MVC Controller 中反序列化 json 数组数据

C# 多线程,无重复

xaml - Xamarin Forms 中心网格水平

ios - xamarin 中的等效 customHTTPProtocol