就目前而言,我的Xamarin Form App解决方案:
|___MyDomain.Mobile
|
|___MyDomain.Mobile.Android
|
|___MyDomain.Mobile.iOS
使用VS 2015,我能够构建和部署到模拟器(6,6s,7,7s,ipad等等)就好了。但是当我尝试使用免费配置文件构建和部署到我的iOS设备(iPad和iPhone)时,我收到以下错误:
2> Generated session id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2> Generated build app name: MyDomain.Mobile.iOS
2> Connecting to Mac server 10.0.0.131...
2> No way to resolve conflict between "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
2>I:\_VSWorkSpace\MyDomain.Mobile\MyDomain.Mobile\MyDomain.Mobile.iOS\Main.cs(21,30,21,31): warning CS0168: The variable 'e' is declared but never used
2> MyDomain.Mobile.iOS -> I:\_VSWorkSpace\MyDomain.Mobile\MyDomain.Mobile\MyDomain.Mobile.iOS\bin\iPhone\Debug\MyDomain.MobileiOS.exe
2> Detected signing identity:
2> Code Signing Key: "iPhone Developer: xxxxxxxxxxx@gmail.com (xxxxxxxxxxxxxx)" (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
2> Provisioning Profile: "iOS Team Provisioning Profile: xxxxxxxxxxxxxxxxxxxxxxxxxxx" (xxxxxxxxxxxxxxxxxxxxx)
2> Bundle Id: xxxxxxxxxxxxxxxxxxxxx
2> App Id: xxxxxxxxxxxxxxxxxxxxxxxxxxx
2>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(696,3): error : Failed to resolve "System.Configuration.ConfigurationException" reference from "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
Build started.
Build FAILED.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
对于错误,链接器设置为默认选项"仅限链接SDK程序集"。尝试"不要链接"给了我以下错误:
2> Generated session id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2> Generated build app name: MyDomain.Mobile.iOS
2> Connecting to Mac server 10.0.0.131...
2> No way to resolve conflict between "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
2>I:\_VSWorkSpace\MyDomain.Mobile\MyDomain.Mobile\MyDomain.Mobile.iOS\Main.cs(21,30,21,31): warning CS0168: The variable 'e' is declared but never used
2> MyDomain.Mobile.iOS -> I:\_VSWorkSpace\MyDomain.Mobile\MyDomain.Mobile\MyDomain.Mobile.iOS\bin\iPhone\Debug\MyDomain.MobileiOS.exe
2> Detected signing identity:
2> Code Signing Key: "iPhone Developer: xxxxxxxxxxxxx@gmail.com (xxxxxxxxxxxxxx)" (xxxxxxxxxxxxxxxxxxxxxxxxx)
2> Provisioning Profile: "iOS Team Provisioning Profile: xxxxxxxxxxxxxxxxxxx" (xxxxxxxxxxxxxxxxxxxxxx)
2> Bundle Id: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
2> App Id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2> AOT Compilation exited with code 1, command:
2> MONO_PATH=/Users/victornguyen/Library/Caches/Xamarin/mtbs/builds/MyDomain.Mobile.iOS/848068465550219d0aabc577444792b2/obj/iPhone/Debug/mtouch-cache/64/Build /Library/Frameworks/Xamarin.iOS.framework/Versions/10.3.1.8/bin/arm64-darwin-mono-sgen --debug -O=gsharedvt --aot=mtriple=arm64-ios,data-outfile=/Users/victornguyen/Library/Caches/Xamarin/mtbs/builds/MyDomain.Mobile.iOS/848068465550219d0aabc577444792b2/obj/iPhone/Debug/mtouch-cache/System.Configuration.arm64.aotdata,static,asmonly,direct-icalls,full,soft-debug,dwarfdebug,no-direct-calls,outfile=/Users/victornguyen/Library/Caches/Xamarin/mtbs/builds/MyDomain.Mobile.iOS/848068465550219d0aabc577444792b2/obj/iPhone/Debug/mtouch-cache/System.Configuration.dll.arm64.s "/Users/victornguyen/Library/Caches/Xamarin/mtbs/builds/MyDomain.Mobile.iOS/848068465550219d0aabc577444792b2/obj/iPhone/Debug/mtouch-cache/64/Build/System.Configuration.dll"
2> Mono Ahead of Time compiler - compiling assembly /Users/victornguyen/Library/Caches/Xamarin/mtbs/builds/MyDomain.Mobile.iOS/848068465550219d0aabc577444792b2/obj/iPhone/Debug/mtouch-cache/64/Build/System.Configuration.dll
2> AOTID 235E9A81-6AF1-63FB-1A9A-E60B79A8A7FA
2> Failed to load method 0x600019c from '/Users/victornguyen/Library/Caches/Xamarin/mtbs/builds/MyDomain.Mobile.iOS/848068465550219d0aabc577444792b2/obj/iPhone/Debug/mtouch-cache/64/Build/System.Configuration.dll' due to Could not resolve type with token 01000047 assembly:System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 type:System.Configuration.ConfigurationException member:<none>.
2> Run with MONO_LOG_LEVEL=debug for more information.
2> AOT of image /Users/victornguyen/Library/Caches/Xamarin/mtbs/builds/MyDomain.Mobile.iOS/848068465550219d0aabc577444792b2/obj/iPhone/Debug/mtouch-cache/64/Build/System.Configuration.dll failed.
2>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(696,3): error : Could not AOT the assembly '/Users/victornguyen/Library/Caches/Xamarin/mtbs/builds/MyDomain.Mobile.iOS/848068465550219d0aabc577444792b2/obj/iPhone/Debug/mtouch-cache/64/Build/System.Configuration.dll'
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
&#34;链接所有组件&#34;选项没有导致任何构建错误,但是当我部署我的应用程序时,它只是一个空白屏幕。我相信这是由于找不到类型MyDomain.Mobile.ViewModels.LoginViewModel&#34;的&#34;默认构造函数。错误,如果我尝试在此模式下以模拟器为目标构建项目,我也会得到错误。
最初,在父解决方案中,我还有一个MyDomain.Mobile.API项目,该项目基本上是我的应用程序将进行API调用的Web服务器。此项目确实引用System.Configuration.dll,并使用System.dll版本4.0.0。我的理解是,当链接程序集并将最终应用程序打包到设备时,此API项目不应干扰MyDomain.Mobile.iOS(它使用2.0.5.0的另一个版本的System.dll),因为它没有依赖于这个MyDomain.Mobile.API。无论如何,因为我遇到了这个System.Configuration参考问题,我继续把这个API项目移到其他地方(在这个解决方案之外)并再次构建iOS(使用所有3个链接器选项)只是为了看它是否有任何区别。它仍然给了我完全相同的错误.....
有人可以给我任何指针来解决这个问题吗?底线是我似乎无法部署到iOS设备;模拟器没问题。
我有另一个XF应用程序使用完全相同版本的Xlabs Forms(2.3.0-pre02)和Xamarin 2.3.1.114,它在两个设备和模拟器上构建和编译都很好
我还注意到MyDomain.Mobile内部还有另外一件事,那就是对MyDomain.Data的引用:这基本上是从另一个共享项目导入的dll逻辑对象。我相信这可能是问题的原因,因为在这个dll中肯定会引用System.Configuration。我将继续与我的团队讨论,看看我们是否可以尝试移动一些东西,看看是否能解决问题