2016-07-26 67 views
0

我刚开始阅读Charles Petzold的书用Xamarain.Forms创建移动应用程序,但没有得到很大的进展,因为我遇到了一些错误和警告,我不知道如何解决它们。我试图卸载Visual Studios并重新安装它无济于事。我收到了一些错误和警告。刚刚安装的Xamarin

我不确定这个问题是真的,因为我能够构建应用程序并将其部署到我的Android设备,以用于Portable或Shared 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”时遇到问题。该项目需要一个未安装的平台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

在浏览器中输入此URL我被告知无法找到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设备。

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

+0

嘿!我已经能够重现这个问题。我将进一步研究,并会让你知道一个解决方法ASAP – clb

+0

嘿。所以这就是我的位置。我可以通过以下步骤重现这些错误。新建共享项目>构建>更新nuget>构建,并且每次我通过执行以下操作(在收到此错误后)解决此问题时关闭Visual Studio>打开Visual Studio>清理项目>构建。你能否尝试这些步骤,让我知道它是否解决了这个问题? – clb

回答

0

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

首先,对于更新NuGet包后可能出现的错误,通常可以通过清理项目来解决。因此,步骤是:更新包>关闭Visual Studio的>打开Visual Studio>清理项目>构建

对于XAMLC错误后,我建立了Xamarin's bug tracking tool

对于IDE0006错误的错误,我也创建a new bug

对于以下错误:

'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Microsoft.NETCore.UniversalWindowsPlatfrom.5.0.0 
: Package restore failed.Rolling back pagage changes for 'App3.UWP'. 

我一直无法重现的错误。但我会努力。只要我可以,我会更新这篇文章。

谢谢!

0

通过更新的NuGet等,我已经摆脱了所有的错误,除了编制“欢迎使用Xamarin窗体”模板时,下列 - 严重性代码说明项目文件的线路抑制状态 警告引用的组件“System.ObjectModel '找不到。

+0

欢迎来到Stack Overflow!这并不能解答这个问题。要批评或要求作者澄清,在他们的帖子下留下评论 - 你总是可以评论你自己的帖子,一旦你有足够的[声誉](http://stackoverflow.com/help/whats-reputation),你会能够[评论任何帖子](http://stackoverflow.com/help/privileges/comment)。 –

相关问题