首先,抱歉我的英语不好。我正在为Android和UWP开发Xamarin PCL应用程序。
对于Android一切正常,但对于UWP它没有。当我在调试模式下构建时,它也可以正常工作,但这是因为公共语言运行时异常已关闭。当它到达Xamarin.Forms.Forms.Init(e);
这些是错误:
发生了System.IO.FileNotFoundException 的HResult = 0x80070002 Message =无法加载文件或程序集'clrcompression,Culture = neutral,PublicKeyToken = null'。 Het systeem kan het opgegeven bestand niet vinden。 来源= 堆栈跟踪: 在System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)
发生了System.IO.FileNotFoundException 的HResult = 0x80070002 Message =无法加载文件或程序集'clrjit,Culture = neutral,PublicKeyToken = null'。 Het systeem kan het opgegeven bestand niet vinden。 来源= 堆栈跟踪: 在System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)
发生了System.IO.FileNotFoundException 的HResult = 0x80070002 Message =无法加载文件或程序集'sqlite3,Culture = neutral,PublicKeyToken = null'。 Het systeem kan het opgegeven bestand niet vinden。 来源= 堆栈跟踪: 在System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)
发生了System.IO.FileNotFoundException 的HResult = 0x80070002 Message =无法加载文件或程序集'ucrtbased,Culture = neutral,PublicKeyToken = null'。 Het systeem kan het opgegeven bestand niet vinden。 来源= 堆栈跟踪: 在System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)
该应用包含多个nuget包和多个可移植库类。 App PCL:
package id="Newtonsoft.Json" version="10.0.3" targetFramework="portable45-
net45+win8" /
package id="Rg.Plugins.Popup" version="1.0.4" targetFramework="portable45-
net45+win8" /
package id="SQLite.Net.Core-PCL" version="3.1.1"
targetFramework="portable45-net45+win8" /
package id="SQLite.Net-PCL" version="3.1.1" targetFramework="portable45-
net45+win8" /
package id="System.Runtime" version="4.3.0" targetFramework="portable45-
net45+win8" /
package id="System.Threading" version="4.3.0" targetFramework="portable45-
net45+win8" /
package id="Xam.Plugins.DownloadManager" version="1.3.2"
targetFramework="portable45-net45+win8" /
package id="Xamarin.Forms" version="2.4.0.18342"
targetFramework="portable45-net45+win8" /
package id="ZXing.Net.Mobile" version="2.2.9" targetFramework="portable45-
net45+win8" /
package id="ZXing.Net.Mobile.Forms" version="2.2.9"
targetFramework="portable45-net45+win8" /
UWP:
"Microsoft.NETCore.Platforms": "1.1.0",
"Microsoft.NETCore.UniversalWindowsPlatform": "6.0.1",
"Microsoft.Toolkit.Uwp.Notifications": "2.0.0",
"Newtonsoft.Json": "10.0.3",
"Rg.Plugins.Popup": "1.0.4",
"SQLite.Net-PCL": "3.1.1",
"SQLite.Net.Core-PCL": "3.1.1",
"System.IO": "4.3.0",
"System.Net.Sockets": "4.3.0",
"System.ObjectModel": "4.3.0",
"System.Runtime": "4.3.0",
"System.Runtime.Handles": "4.3.0",
"System.Threading": "4.3.0",
"Xam.Plugin.Connectivity": "3.0.3",
"Xam.Plugins.DownloadManager": "1.3.2",
"Xamarin.Forms": "2.4.0.18342",
"ZXing.Net.Mobile": "2.2.9",
"ZXing.Net.Mobile.Forms": "2.2.9"
图书馆课程1:
PCL:
package id="Newtonsoft.Json" version="10.0.3" targetFramework="portable45-
net45+win8" /
package id="SQLite.Net.Core-PCL" version="3.1.1"
targetFramework="portable45-net45+win8" /
package id="SQLite.Net-PCL" version="3.1.1" targetFramework="portable45-
net45+win8" /
package id="Xamarin.Forms" version="2.4.0.18342"
targetFramework="portable45-net45+win8" /
UWP:
Microsoft.netcore.universalwindowsplatform
newtonsoft.json
sqlite.net-pcl
sqlite.net.core-pcl
xamarin.froms
图书馆类2:
PCL:
package id="Xamarin.Forms" version="2.4.0.18342"
targetFramework="portable45-net45+win8" /
UWP:
microsoft.netcore.universalwindowsplatform
microsoft.toolkit.uwp.notifications.
sqlite for universal windows platform
universal windows
windows desktop extensions for the uwp
windows IoT extensions for the UWP
Windows Mobile extensions for the uwp
Windows Team extensions for the uwp
xam.plugin.connectivity
xamarin.forms
有人知道如何解决这个问题吗?
更新: 错误1(clrcompression)是固定的。 这是因为基础项目使用的软件包具有版本4.1.0的System.io.compression和使用4.3.0的应用程序的依赖性 (但是nuget包是相同的版本)我改变之后它被修复了。但这不容易找到。这就是为什么其他3个错误仍然存在的原因。