2016-08-09 47 views
0

我使用XAMARIN開發UWP應用程序。我在使用.NET本地工具鏈進行編譯時遇到了問題。當我檢查的標誌「使用.NET本地工具鏈編譯」,我得到在運行時出現錯誤的「Xamarin.Init」的方法:在 系統‘System.IO.FileNotFoundException’:Xamarin with UWP - 「FileNotFound_AssemblyNotFound,ClrCompression」

「拋出異常。 Private.Reflection.Core.dll

附加信息:FileNotFound_AssemblyNotFound,ClrCompression 欲瞭解更多信息,請訪問 http://go.microsoft.com/fwlink/?LinkId=623485

和下一個:

「拋出異常:FileNotFound_AssemblyNotFound,sqlite3的:在 System.Private.Reflection.Core.dll

附加信息 'System.IO.FileNotFoundException'。對於 瞭解更多信息,請訪問:http://go.microsoft.com/fwlink/?LinkId=623485

我加SqlLite assmebly,根據建議從 https://developer.xamarin.com/guides/xamarin-forms/platform-features/windows/installation/universal/#Dependency_Services_and_.NET_Native_Compilation

List<Assembly> assembliesToInclude = new List<Assembly>(); 
var assembly = typeof(SQLitePlatformWinRT).GetTypeInfo().Assembly; 
assembliesToInclude.Add(assembly); 
//throws error there 
Xamarin.Forms.Forms.Init(e, assembliesToInclude); 

我引用: enter image description here

有誰知道什麼問題

+0

我在微軟工作,很樂意提供幫助。你可以發送你的project.json和project.lock.json文件給我們嗎? [email protected]。 –

+0

對此有何結果?我與我的Xamarin.Uwp項目有同樣的問題,無法解決它。 – Tom

+0

@Tom在下面看到我的答案,並讓我知道它是否有幫助 – Ania

回答

0

解決方案是從我的解決方案中添加組合。 您必須添加解決方案中的所有組件。 參見: https://developer.xamarin.com/guides/xamarin-forms/platform-features/windows/installation/universal/#Target_Invocation_Exception_when_using_Compile_with_.NET_Native_tool_chain

嘗試從解決方案中添加組件。

List<Assembly> assembliesToInclude = new List<Assembly>(); 
    assembliesToInclude.Add(typeof(<a class from assembly>).GetTypeInfo().Assembly); 

    Xamarin.Forms.Forms.Init(e, assembliesToInclude); 
+1

我知道Xamarin-article,但到目前爲止我還沒有成功。我有幾個參考,也是pcl,也有參考。所以我不知道,哪些程序集要添加到這個列表中。你能否將你的代碼發佈到你的程序集列表中? – Tom