2016-10-27 32 views
5

我想提高Xamarin.Forms UWP應用程序的性能,因爲它在發佈模式下非常慢(選中「.NET本機」)。所以,我在PCL項目彙編級應用XAMLC:Xamarin.Forms - XamlCompilation MissingMethodException

[assembly: XamlCompilation (XamlCompilationOptions.Compile)] 
namespace MyApp 
{ 
} 

但這個屬性我收到運行時錯誤:

"Method not found: 'Void Xamarin.Forms.Xaml.Internals.SimpleValueTargetProvider..ctor(System.Object[])'."

根據此:

https://github.com/xamarin/Xamarin.Forms/blob/master/docs/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.Internals/SimpleValueTargetProvider.xml

的SimpleValueTargetProvider類有2個版本:

  • 1.5.0.0 - 構造帶有一個參數System.Object的[]
  • 2.0.0.0 - 構造有兩個參數的System.Object的[]和System.Object的

我使用Xamarin.Forms 2.3.3.163 -pre3,所以我在我的項目中使用第二個版本(當我導航到Xamarin.Forms.Xaml.Internals中的SimpleValueTargetProvider時,我可以看到具有2個參數的構造函數)。我的理解是,顯然「東西」仍然調用SimpleValueTargetProvider 1.5.0.0,但我不知道它是什麼。

我刪除了所有的第三方組件,但它沒有幫助。我用融合日誌來找出到底是怎麼回事,但是這是我得到的(如果這是關係到我現在面臨的所有問題,說實話我不知道):

> *** Assembly Binder Log Entry (10/26/2016 @ 9:09:42 PM) *** 
> 
> The operation failed. Bind result: hr = 0x80070002. The system cannot 
> find the file specified. 
> 
> Assembly manager loaded from: 
> C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under 
> executable C:\Program Files (x86)\Microsoft Visual 
> Studio\VS15Preview\Common7\IDE\devenv.exe 
> --- A detailed error log follows. 
> 
> === Pre-bind state information === LOG: DisplayName = XamlDesignerFaultInjection (Partial) WRN: Partial binding information 
> was supplied for an assembly: WRN: Assembly Name: 
> XamlDesignerFaultInjection | Domain ID: 1 WRN: A partial bind occurs 
> when only part of the assembly display name is provided. WRN: This 
> might result in the binder loading an incorrect assembly. WRN: It is 
> recommended to provide a fully specified textual identity for the 
> assembly, WRN: that consists of the simple name, version, culture, and 
> public key token. WRN: See whitepaper 
> http://go.microsoft.com/fwlink/?LinkId=109270 for more information and 
> common solutions to this issue. LOG: Appbase = file:///C:/Program 
> Files (x86)/Microsoft Visual Studio/VS15Preview/Common7/IDE/ LOG: 
> Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = 
> NULL LOG: AppName = devenv.exe Calling assembly : (Unknown). 
> === LOG: This bind starts in default load context. LOG: Using application configuration file: 
> C:\Users\blaze\AppData\Local\Microsoft\VisualStudio\15.0_2f751565\devenv.exe.config 
> LOG: Using host configuration file: LOG: Using machine configuration 
> file from 
> C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. 
> LOG: Policy not being applied to reference at this time (private, 
> custom, partial, or location-based assembly bind). LOG: Attempting 
> download of new URL file:///C:/Program Files (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/XamlDesignerFaultInjection.DLL. LOG: 
> Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/Debugger/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/Debugger/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/x86/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/x86/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/XamlDesignerFaultInjection.EXE. LOG: 
> Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection.EXE. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection.EXE. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/XamlDesignerFaultInjection.EXE. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/Debugger/XamlDesignerFaultInjection.EXE. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/Debugger/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/XamlDesignerFaultInjection.EXE. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/XamlDesignerFaultInjection.EXE. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/x86/XamlDesignerFaultInjection.EXE. 
> LOG: Attempting download of new URL file:///C:/Program Files 
> (x86)/Microsoft Visual 
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/x86/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE. 
> LOG: All probing URLs attempted and failed. 

這是Xamarin.Forms或XamlCTask中的錯誤?有沒有人遇到這個問題或知道如何解決它?

  • 視窗10的64位
  • 視覺Studion 15預覽5
  • Xamarin 4.2.1.14
  • Xamarin.Forms 2.3.3.163-PRE3

預先感謝

回答

8

這在IDE或項目級別上可能是一個緩存問題。

如果它在IDE級別: - 做一個乾淨的 - 重啓VS或XS - 重建

但你可能嘗試過了。

我的猜測是其中一個nuget更新沒有正確清理,並且您的解決方案的不同項目中引用了不同版本的XF,或者一個.csproj文件引用了舊的.targets文件。

一些手動清理將有望解決問題。

+0

感謝Stephane!手動清潔解決了問題。 – Blazey

+1

@Blazey什麼是手動清潔?刪除軟件包文件夾中的所有內容或從項目中刪除所有軟件包? – batmaci

+0

我在記事本中編輯了.csproj,並刪除了對XF的所有舊引用。 – Blazey

3

如果您的項目依賴於使用XamlC的第三方程序集,並且該程序集是在XF < 2.3.3上構建的,則仍然可以解決此問題。

修復程序存在並將作爲XF 2.3.3的第一個服務版本的一部分發布