簡體   English   中英

如何將第三方庫添加到 UNO 平台 WebAssembly 項目

[英]How to add third party libraries to a UNO platform WebAssembly project

我創建了一個包含 WebAssembly 項目的 UNO 平台 .NET 解決方案。 我打算添加一些第三方組件,所以我將他們的 UWP NuGet package 添加到 UPW 項目中。

不幸的是,當我構建時,我在 WebAssembly 項目中收到以下錯誤:

System.InvalidOperationException: An error occurred when processing Grid at line 103:4
(D:\UnoTesting\UnoTesting.Shared\MainPage.xaml) : 
The type {using:Syncfusion.UI.Xaml.Grid}SfDataGrid could not be found --->
System.InvalidOperationException: The type {using:Syncfusion.UI.Xaml.Grid}SfDataGrid could not be found
   at : Uno.UI.SourceGenerators.XamlGenerator.XamlFileGenerator.GetType(XamlType type) at:
   D:\a\1\s\src\SourceGenerators\Uno.UI.SourceGenerators\XamlGenerator\XamlFileGenerator.Reflection.cs, line: 722

因此,當我嘗試使用庫時,它必須為每個平台(Android、macOS、WebAssembly)提供 NuGet 包嗎? 如果沒有 package 那么我應該使用 Windows 社區工具包嗎?

Yes, if you want to use a NuGet package with an Uno app or library, then the package must be available for all the platforms you wish to support (typically visible under the Dependencies tab on the NuGet page). 在這種情況下,SyncFusion 控件尚不可用。

Windows 社區工具包可作為替代方案。 Uno 的最新穩定版本支持 WCT 中的DataGrid 注意對於 WebAssembly 和其他非 UWP 項目,您需要使用 WCT 的 Uno 編譯版本,它們當前是單獨的 NuGet 包: Uno.Microsoft.ToolkitUno.Microsoft.Toolkit.Uwp.UI.Controls ,等等

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM