我成功安装了Xamarin并创建了一个新项目。在没有代码的情况下,我在引用下遇到以下错误,并获得Xamarin.Forms缺失的错误。我尝试过搜索,但我没有看到修复程序建议工作时出现同样的错误。谢谢。
错误:
Framework not installed: .NETPortable, Version=v4.5
系统设置:
Windows 7(Build 7601:Service Pack 1)
Xamarin Studio 5.1.4(Build 0)
Visual Studio 11.0.50727.1 RTMREL Ultimate
.NET Framework版本4.5.50709
尝试从VisualStudio启动项目时出现以下错误:
所以我尝试以管理员身份启动其他内容,然后输出:
Adding Xamarin.Forms...
Installing 'Xamarin.Forms 1.0.6186'.
Added file 'Xamarin.Forms.Build.Tasks.dll' to folder 'Xamarin.Forms.1.0.6186\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10'.
Added file 'Xamarin.Forms.targets' to folder 'Xamarin.Forms.1.0.6186\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10'.
Added file 'Xamarin.Forms.Core.dll' to folder 'Xamarin.Forms.1.0.6186\lib\MonoAndroid10'.
Added file 'Xamarin.Forms.Core.xml' to folder 'Xamarin.Forms.1.0.6186\lib\MonoAndroid10'.
Added file 'Xamarin.Forms.Platform.Android.dll' to folder 'Xamarin.Forms.1.0.6186\lib\MonoAndroid10'.
Added file 'Xamarin.Forms.Xaml.dll' to folder 'Xamarin.Forms.1.0.6186\lib\MonoAndroid10'.
Added file 'Xamarin.Forms.Xaml.xml' to folder 'Xamarin.Forms.1.0.6186\lib\MonoAndroid10'.
Added file 'Xamarin.Forms.Core.dll' to folder 'Xamarin.Forms.1.0.6186\lib\MonoTouch10'.
Added file 'Xamarin.Forms.Core.xml' to folder 'Xamarin.Forms.1.0.6186\lib\MonoTouch10'.
Added file 'Xamarin.Forms.Platform.iOS.dll' to folder 'Xamarin.Forms.1.0.6186\lib\MonoTouch10'.
Added file 'Xamarin.Forms.Xaml.dll' to folder 'Xamarin.Forms.1.0.6186\lib\MonoTouch10'.
Added file 'Xamarin.Forms.Xaml.xml' to folder 'Xamarin.Forms.1.0.6186\lib\MonoTouch10'.
Added file 'Xamarin.Forms.Core.dll' to folder 'Xamarin.Forms.1.0.6186\lib\portable-win+net45+wp80+MonoAndroid10+MonoTouch10'.
Added file 'Xamarin.Forms.Core.xml' to folder 'Xamarin.Forms.1.0.6186\lib\portable-win+net45+wp80+MonoAndroid10+MonoTouch10'.
Added file 'Xamarin.Forms.Xaml.dll' to folder 'Xamarin.Forms.1.0.6186\lib\portable-win+net45+wp80+MonoAndroid10+MonoTouch10'.
Added file 'Xamarin.Forms.Xaml.xml' to folder 'Xamarin.Forms.1.0.6186\lib\portable-win+net45+wp80+MonoAndroid10+MonoTouch10'.
Added file 'Xamarin.Forms.Core.dll' to folder 'Xamarin.Forms.1.0.6186\lib\WP80'.
Added file 'Xamarin.Forms.Core.xml' to folder 'Xamarin.Forms.1.0.6186\lib\WP80'.
Added file 'Xamarin.Forms.Platform.WP8.dll' to folder 'Xamarin.Forms.1.0.6186\lib\WP80'.
Added file 'Xamarin.Forms.Xaml.dll' to folder 'Xamarin.Forms.1.0.6186\lib\WP80'.
Added file 'Xamarin.Forms.Xaml.xml' to folder 'Xamarin.Forms.1.0.6186\lib\WP80'.
Added file 'Xamarin.Forms.1.0.6186.nupkg' to folder 'Xamarin.Forms.1.0.6186'.
Successfully installed 'Xamarin.Forms 1.0.6186'.
Adding 'Xamarin.Forms 1.0.6186' to Test.
Could not install package 'Xamarin.Forms 1.0.6186'. 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.
答案 0 :(得分:12)
如果您没有安装Visual Studio,则以下步骤适用于我:
下载Portable Tools 2扩展程序并使用/buildmachine
开关进行安装:PortableLibraryTools.exe /buildmachine
将v4.0
的内容(目录v4.5
,v4.6
和C:\Program Files (x86)\Microsoft .NET Portable Library Reference Assemblies 4.6
)复制到C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable
(覆盖任何现有文件)。 [如果您想要安全起见,请备份原始文件!]
答案 1 :(得分:3)
看起来您的计算机上没有安装可移植类库。
Xamarin目前不在Windows上为您安装PCL。通常它们与Visual Studio一起安装,但它们可以单独下载。
PCL安装在Windows上的以下目录中:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable
检查您是否有该目录。如果您没有此目录,则需要先安装Portable Class Library Tools,然后再安装Portable Class Libraries v4.6。
我怀疑你可能只是错过了v4.6 PCL。
Profile78是Portable Class Libraries v4.6的一部分。如果你安装它,它会将.zip文件放入目录:
C:\Program Files (x86)\Microsoft .NET Portable Library Reference Assemblies 4.6
您需要解压缩并将内容解压缩到C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable
目录。