我收到了一些错误和警告。刚刚安装了Xamarin

时间:2016-07-26 21:25:16

标签: visual-studio xamarin

我刚刚开始阅读Charles Petzold撰​​写的“使用Xamarain.Forms创建移动应用程序”一书但却没有取得多大成果,因为我遇到了许多错误和警告,我不知道如何修复它们。我已经尝试卸载Visual Studios并重新安装它无济于事。

我不确定这个问题究竟是什么,因为我能够为我的Android设备构建和部署应用程序,用于便携式或共享Xamarin.Forms应用程序。我只想了解这些错误究竟是什么以及如何解决它们。如果某个地方有资源我可以了解它们,或者如果答案简单明了,我很乐意知道。

非常感谢,

我在下面列出了我为每种类型的应用获得的所有错误和警告。

从空白的Xamarin.Forms便携式应用开始。

第一次对话错误:

Package Installation Error 
Could not add all required packages to the project.
The following packages failed to install from 
'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Microsoft.NETCore.UniversalWindowsPlatfrom.5.0.0 
: Package restore failed.Rolling back pagage changes for 'App3.UWP'.

在错误列表中我有12个警告

Severity    Code Description Project File    Line Suppression State
Warning IDE0006 Error encountered while loading the project.Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.App3        1   Active
Warning     The "XamlCTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'c:\users\user\documents\visual studio 2015\Projects\App3\App3\App3\obj\Debug\App3.dll'.
File name: 'c:\users\user\documents\visual studio 2015\Projects\App3\App3\App3\obj\Debug\App3.dll'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.GetFileStream(String fileName, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at Xamarin.Forms.Build.Tasks.XamlCTask.Compile()
   at Xamarin.Forms.Build.Tasks.XamlCTask.Execute()
   at Microsoft.Build.Framework.ITask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() App3
Warning IDE0006 Error encountered while loading the project.Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.App3.Droid      1   Active
Warning     Unexpected error - Please file a bug report at http://bugzilla.xamarin.com. Reason: System.IO.FileNotFoundException: Could not load assembly 'App3, Version=, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?  App3.Droid          
Warning Type universe cannot resolve assembly: System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.App3.UWP
Warning     Cannot resolve Assembly or Windows Metadata file 'System.Runtime.dll'   App3.UWP c:\users\user\documents\visual studio 2015\Projects\App3\App3\App3.UWP\App3.UWP.csproj
Warning IDE0006 Error encountered while loading the project.Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.App3.WinPhone       1   Active
Warning     The "XamlCTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'c:\users\user\documents\visual studio 2015\Projects\App3\App3\App3.WinPhone\obj\Debug\App3.WinPhone.exe'.
File name: 'c:\users\user\documents\visual studio 2015\Projects\App3\App3\App3.WinPhone\obj\Debug\App3.WinPhone.exe'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.GetFileStream(String fileName, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at Xamarin.Forms.Build.Tasks.XamlCTask.Compile()
   at Xamarin.Forms.Build.Tasks.XamlCTask.Execute()
   at Microsoft.Build.Framework.ITask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() App3.WinPhone
Warning IDE0006 Error encountered while loading the project.Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.App3.Windows        1   Active
Warning     The "XamlCTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'c:\users\user\documents\visual studio 2015\Projects\App3\App3\App3.Windows\obj\Debug\App3.Windows.exe'.
File name: 'c:\users\user\documents\visual studio 2015\Projects\App3\App3\App3.Windows\obj\Debug\App3.Windows.exe'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.GetFileStream(String fileName, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at Xamarin.Forms.Build.Tasks.XamlCTask.Compile()
   at Xamarin.Forms.Build.Tasks.XamlCTask.Execute()
   at Microsoft.Build.Framework.ITask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() App3.Windows
Warning IDE0006 Error encountered while loading the project.Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.App3.iOS        1   Active
Warning     The "XamlCTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'c:\users\user\documents\visual studio 2015\Projects\App3\App3\App3.iOS\obj\iPhone\Debug\App3iOS.exe'.
File name: 'c:\users\user\documents\visual studio 2015\Projects\App3\App3\App3.iOS\obj\iPhone\Debug\App3iOS.exe'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.GetFileStream(String fileName, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at Xamarin.Forms.Build.Tasks.XamlCTask.Compile()
   at Xamarin.Forms.Build.Tasks.XamlCTask.Execute()
   at Microsoft.Build.Framework.ITask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() App3.iOS

在尝试构建解决方案时,我得到14个错误和8个警告

Severity Code    Description Project File Line    Suppression State
Warning The "XamlCTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'c:\users\user\documents\visual studio 2015\Projects\App3\App3\App3.iOS\obj\iPhone\Debug\App3iOS.exe'.
File name: 'c:\users\user\documents\visual studio 2015\Projects\App3\App3\App3.iOS\obj\iPhone\Debug\App3iOS.exe'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.GetFileStream(String fileName, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at Xamarin.Forms.Build.Tasks.XamlCTask.Compile()
   at Xamarin.Forms.Build.Tasks.XamlCTask.Execute()
   at Microsoft.Build.Framework.ITask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() App3.iOS
Error       Xamarin.Forms 2.0.0.6482 is not compatible with UAP, Version = v10.0 (win10-arm-aot).           0   
Error Xamarin.Forms 2.0.0.6482 is not compatible with UAP, Version= v10.0 (win10-x64).          0   
Error Xamarin.Forms 2.0.0.6482 is not compatible with UAP, Version= v10.0.          0   
Error Some packages are not compatible with UAP, Version= v10.0 (win10-x86-aot).            0   
Error Xamarin.Forms 2.0.0.6482 is not compatible with UAP, Version= v10.0 (win10-x86-aot).          0   
Error Xamarin.Forms 2.0.0.6482 is not compatible with UAP, Version= v10.0 (win10-x86).          0   
Error Some packages are not compatible with UAP, Version = v10.0 (win10-x64-aot).           0   
Error Some packages are not compatible with UAP, Version = v10.0 (win10-arm-aot).           0   
Error Some packages are not compatible with UAP, Version = v10.0 (win10-x64).           0   
Error Some packages are not compatible with UAP, Version = v10.0 (win10-arm).           0   
Error Some packages are not compatible with UAP, Version = v10.0 (win10-x86).           0   
Error Xamarin.Forms 2.0.0.6482 is not compatible with UAP, Version= v10.0 (win10-arm).          0   
Error Some packages are not compatible with UAP, Version = v10.0.           0   
Error Xamarin.Forms 2.0.0.6482 is not compatible with UAP, Version= v10.0 (win10-x64-aot).          0   
Warning IDE0006 Error encountered while loading the project.Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.App3        1   Active
Warning IDE0006 Error encountered while loading the project.Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.App3.Droid      1   Active
Warning     Type universe cannot resolve assembly: System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.App3.UWP
Warning     Cannot resolve Assembly or Windows Metadata file 'System.Runtime.dll'   App3.UWP c:\users\user\documents\visual studio 2015\Projects\App3\App3\App3.UWP\App3.UWP.csproj
Warning IDE0006 Error encountered while loading the project.Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.App3.WinPhone       1   Active
Warning IDE0006 Error encountered while loading the project.Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.App3.Windows        1   Active
Warning IDE0006 Error encountered while loading the project.Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.App3.iOS        1   Active

我能够将Xamarin.Froms Portable调试/部署到我的Android设备。

当我创建一个空白的Xamarin.forms共享应用程序时,我收到对话框错误:     创建子项目App4.UWP&#39;时遇到问题。该项目需要未安装的平台SDK(UAP,版本= 10.0.10240.0),请访问以下链接以获取更多信息:http://go.microsft.com/fwlink/?prd=12514&pver=14.0&sbp=PlatformSDKMissing&plcid=0x409&o1=UAP,%20Version=10.0.10240.0

在我的浏览器中输入此网址我被告知无法找到DNS地址。

完成项目创建后,我有6个警告:

Severity Code    Description Project File Line    Suppression State
Warning The referenced component 'System.ObjectModel' could not be found.   App4.Droid
Warning     The "XamlCTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'c:\users\user\documents\visual studio 2015\Projects\App4\App4\App4.Droid\obj\Debug\App4.Droid.dll'.
File name: 'c:\users\user\documents\visual studio 2015\Projects\App4\App4\App4.Droid\obj\Debug\App4.Droid.dll'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.GetFileStream(String fileName, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at Xamarin.Forms.Build.Tasks.XamlCTask.Compile()
   at Xamarin.Forms.Build.Tasks.XamlCTask.Execute()
   at Microsoft.Build.Framework.ITask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() App4.Droid
Warning The "XamlCTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'c:\users\user\documents\visual studio 2015\Projects\App4\App4\App4.WinPhone\obj\Debug\App4.WinPhone.exe'.
File name: 'c:\users\user\documents\visual studio 2015\Projects\App4\App4\App4.WinPhone\obj\Debug\App4.WinPhone.exe'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.GetFileStream(String fileName, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at Xamarin.Forms.Build.Tasks.XamlCTask.Compile()
   at Xamarin.Forms.Build.Tasks.XamlCTask.Execute()
   at Microsoft.Build.Framework.ITask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() App4.WinPhone
Warning IDE0006 Error encountered while loading the project.Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.App4.Windows        1   Active
Warning The "XamlCTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'c:\users\user\documents\visual studio 2015\Projects\App4\App4\App4.Windows\obj\Debug\App4.Windows.exe'.
File name: 'c:\users\user\documents\visual studio 2015\Projects\App4\App4\App4.Windows\obj\Debug\App4.Windows.exe'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.GetFileStream(String fileName, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at Xamarin.Forms.Build.Tasks.XamlCTask.Compile()
   at Xamarin.Forms.Build.Tasks.XamlCTask.Execute()
   at Microsoft.Build.Framework.ITask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() App4.Windows

当我构建解决方案时,我得到3个警告

Severity Code    Description Project File Line    Suppression State
Warning The "XamlCTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'c:\users\user\documents\visual studio 2015\Projects\App4\App4\App4.iOS\obj\iPhone\Debug\App4iOS.exe'.
File name: 'c:\users\user\documents\visual studio 2015\Projects\App4\App4\App4.iOS\obj\iPhone\Debug\App4iOS.exe'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.GetFileStream(String fileName, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at Xamarin.Forms.Build.Tasks.XamlCTask.Compile()
   at Xamarin.Forms.Build.Tasks.XamlCTask.Execute()
   at Microsoft.Build.Framework.ITask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() App4.iOS
Warning     The referenced component 'System.ObjectModel' could not be found.App4.Droid
Warning IDE0006 Error encountered while loading the project.Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.App4.Windows        1   Active

我能够构建和调试/部署Xamarin.Forms共享到我的Android设备。

那么我需要做些什么才能解决这些警告和错误?

2 个答案:

答案 0 :(得分:0)

对于这些问题,我有一些答案和一些前进方法。首先,应该指出的是,这些似乎是不同的问题,但我会尽可能地回答。

首先,对于更新NuGet包后可能发生的错误,通常可以通过清理项目来解决这些错误。所以步骤将是:更新包&gt;之后关闭Visual Studio&gt;打开Visual Studio&gt;清洁项目&gt;构建

对于XAMLC错误,我在Xamarin's bug tracking tool

上创建了一个错误

对于IDE0006错误,我还创建了a new bug

对于以下错误:

lapply

我无法重现该错误。但我会努力尝试。我会尽快更新这篇文章。

谢谢!

答案 1 :(得分:0)

通过更新nuget等,我在编译&#34;欢迎使用Xamarin Forms&#34;时除了以下所有错误。模板 - 严重性代码描述项目文件行抑制状态 警告引用的组件&#39; System.ObjectModel&#39;无法找到。