解決要建置 Xamarin.Forms 專案,發生 ResolveLibraryProjectImports 的問題
嚴重性 程式碼 說明 專案 檔案 行 隱藏項目狀態
錯誤 "ResolveLibraryProjectImports" 工作發生未預期的失敗。
System.IO.FileNotFoundException: Could not load assembly 'XF2001, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
檔案名稱: 'XF2001.dll'
於 Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
於 Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
於 Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
於 Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
於 Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
於 Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() XF2001.Android
或者
嚴重性 程式碼 說明 專案 檔案 行 隱藏項目狀態
錯誤 Failed to generate resource table for split '' "Failed to generate resource table for split ''". DynamicFlexLayout.Android
嚴重性 程式碼 說明 專案 檔案 行 隱藏項目狀態
錯誤 "LinkAssemblies" 工作發生未預期的失敗。
System.IO.FileNotFoundException: Could not load assembly 'DynamicFlexLayout.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
檔案名稱: 'DynamicFlexLayout.Android.dll'
於 Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
於 Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)
於 Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
於 Xamarin.Android.Tasks.LinkAssemblies.Execute()
於 Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
於 Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() DynamicFlexLayout.Android
或者
嚴重性 程式碼 說明 專案 檔案 行 隱藏項目狀態
錯誤 Can not resolve reference: `Xamarin.Forms.Xaml`, referenced by `XF3031`. Please add a NuGet package or assembly reference for `Xamarin.Forms.Xaml`, or remove the reference to `XF3031`. XF3031.Android
錯誤 No resource found that matches the given name: attr 'colorPrimaryDark'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 2
錯誤 No resource found that matches the given name: attr 'windowNoTitle'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 2
錯誤 No resource found that matches the given name: attr 'colorPrimary'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 2
錯誤 No resource found that matches the given name: attr 'windowActionBar'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 2
錯誤 Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 2
錯誤 No resource found that matches the given name: attr 'colorAccent'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 3
錯誤 No resource found that matches the given name: attr 'colorAccent'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 4
錯誤 No resource found that matches the given name: attr 'windowActionModeOverlay'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 4
錯誤 Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 4
從此錯誤訊息中可以看到 "ResolveLibraryProjectImports" 工作發生未預期的失敗,而且有個 System.IO.FileNotFoundException: Could not load assembly 這樣的例外異常;當看到這樣的錯誤訊息,最快的解決方案就是先清除所有的專案,並且關閉您的 Visual Studio 2019 專案,並且重新開啟該 Xamarin.Forms 方案,重新再建置一次,一切問題都迎刃而解了。
嚴重性 程式碼 說明 專案 檔案 行 隱藏項目狀態
錯誤 "ResolveLibraryProjectImports" 工作發生未預期的失敗。
System.IO.FileNotFoundException: Could not load assembly 'XF2001, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
檔案名稱: 'XF2001.dll'
於 Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
於 Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
於 Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
於 Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
於 Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
於 Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() XF2001.Android
嚴重性 程式碼 說明 專案 檔案 行 隱藏項目狀態
錯誤 Failed to generate resource table for split '' "Failed to generate resource table for split ''". DynamicFlexLayout.Android
嚴重性 程式碼 說明 專案 檔案 行 隱藏項目狀態
錯誤 "LinkAssemblies" 工作發生未預期的失敗。
System.IO.FileNotFoundException: Could not load assembly 'DynamicFlexLayout.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
檔案名稱: 'DynamicFlexLayout.Android.dll'
於 Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
於 Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)
於 Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
於 Xamarin.Android.Tasks.LinkAssemblies.Execute()
於 Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
於 Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() DynamicFlexLayout.Android
嚴重性 程式碼 說明 專案 檔案 行 隱藏項目狀態
錯誤 Can not resolve reference: `Xamarin.Forms.Xaml`, referenced by `XF3031`. Please add a NuGet package or assembly reference for `Xamarin.Forms.Xaml`, or remove the reference to `XF3031`. XF3031.Android
錯誤 No resource found that matches the given name: attr 'colorPrimaryDark'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 2
錯誤 No resource found that matches the given name: attr 'windowNoTitle'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 2
錯誤 No resource found that matches the given name: attr 'colorPrimary'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 2
錯誤 No resource found that matches the given name: attr 'windowActionBar'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 2
錯誤 Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 2
錯誤 No resource found that matches the given name: attr 'colorAccent'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 3
錯誤 No resource found that matches the given name: attr 'colorAccent'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 4
錯誤 No resource found that matches the given name: attr 'windowActionModeOverlay'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 4
錯誤 Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'. XF3031.Android D:\Vulcan\GitHub\XCourse19\XF3031\Solution\XF3031\XF3031.Android\Resources\values\styles.xml 4
有時候當建立好一個 Xamarin.Forms 專案,撰寫了一些程式碼之後,準備要進行建置該專案的動作,此時,會得到這樣的錯誤訊息