编程语言
首页 > 编程语言> > c#-Xamarin Studio中的Xamarin.Forms

c#-Xamarin Studio中的Xamarin.Forms

作者:互联网

我下载了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包不见了,所以我点击了Project>添加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上安装可移植类库,您可以使用以下三个选项:

>安装Visual Studio 2013(完整版或快速版).需要更新2或更高版本.
>安装Portable Library ToolsPortable Library Reference Assemblies 4.6.
>安装可移植库工具,然后将.NETPortable目录从Mono复制到Windows.

2.的一个问题是,安装可移植库参考程序集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帖子中有更多详细信息,但以上内容应为您提供所需的概述.

标签:xamarin,xamarin-forms,xamarin-studio,c
来源: https://codeday.me/bug/20191028/1949768.html