简体   繁体   English

Xamarin.Forms在Xamarin工作室

[英]Xamarin.Forms in Xamarin Studio

I downloaded Xamarin Studio to build my first application, but I'm having some problems which I have not found a solution. 我下载了Xamarin Studio来构建我的第一个应用程序,但是我遇到了一些我没有找到解决方案的问题。

First of all I have created a new solution with the App Xamarin.Forms Blank template. 首先,我使用App Xamarin.Forms Blank模板创建了一个新的解决方案。 When I have tried to build it, a few errors have appeared (I did not changed a single line from the template): 当我尝试构建它时,出现了一些错误(我没有从模板中更改一行):


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?)

Then I supposed that the Xamarin.Forms package was missing, so I clicked on Project > Add NuGet Packages... and I tried to install the Xamarin.Forms package. 然后我认为Xamarin.Forms包丢失了,所以我点击了Project> Add NuGet Packages ...我尝试安装Xamarin.Forms包。 Here is where I get stuck, because a new error is displayed: 这是我卡住的地方,因为显示了一个新错误:


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.

I would appreciate any help, because I have not found any solution. 我会感激任何帮助,因为我没有找到任何解决方案。

The error message suggests that you do not have the Portable Class Libraries (PCLs) installed. 错误消息表明您没有安装可移植类库(PCL)。

If you are on the Mac you can get these installed by installing the Mono Development Kit (MDK) . 如果您使用的是Mac,则可以通过安装Mono Development Kit(MDK)来安装这些软件。

If you are on Windows the procedure is a bit more tricky. 如果你在Windows上,程序有点棘手。 To install the Portable Class Libraries on Windows you have three options: 要在Windows上安装可移植类库,您有三个选择:

  1. Install Visual Studio 2013 (full or Express version). 安装Visual Studio 2013(完整版或Express版)。 Update 2 or above is required. 需要更新2或更高版本。
  2. Install the Portable Library Tools and the Portable Library Reference Assemblies 4.6 . 安装可移植库工具可移植库参考程序集4.6
  3. Install the Portable Library Tools and copy the .NETPortable directory from Mono over to Windows. 安装可移植库工具并将.NETPortable目录从Mono复制到Windows。

One problem with 2. is that installing the Portable Library Reference Assemblies 4.6 does not install them into the correct location but instead just installs a PortableReferenceAssemblies.zip file into the directory: 2.的一个问题是安装可移植库参考组件4.6不会将它们安装到正确的位置,而只是将PortableReferenceAssemblies.zip文件安装到目录中:

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

This PortableReferenceAssemblies.zip file contains three directories (4.0, 4.5 and 4.6) which need to be extracted and copied into the PCLs directory: 此PortableReferenceAssemblies.zip文件包含三个目录(4.0,4.5和4.6),需要将其解压缩并复制到PCLs目录中:

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

There is more detail in the Installing Portable Class Libraries for Xamarin Studio post but the above should give you an overview of what is required. 有关Xamarin Studio安装可移植类库的详细信息,但上面的内容应该概述了所需的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM