首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >Xamarin Forms 构建 WPF 版项目失败提示 XamlC error XFC0000 错误

Xamarin Forms 构建 WPF 版项目失败提示 XamlC error XFC0000 错误

作者头像
林德熙
发布2022-08-12 19:17:42
发布2022-08-12 19:17:42
2.3K0
举报
文章被收录于专栏:林德熙的博客林德熙的博客

在 Xamarin Forms 从 4.7 到 4.8.0.1560 版本,在 Xamarin Forms 构建 WPF 版项目也许会提示 XamlC error XFC0000 : Cannot resolve type “Application” 构建失败

提示内容如下

代码语言:javascript
复制
App.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "Application".
AppShell.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "Shell".
Views/AboutPage.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "ContentPage".
Views/ItemDetailPage.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "ContentPage".
Views/ItemsPage.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "ContentPage".
Views/NewItemPage.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "ContentPage".

[Bug] XAML compiler broke with 4.7.0 · Issue #11101 · xamarin/Xamarin.Forms 所说,一个可以使用的方法是 Michael Schnerring 大佬提供的方法

在 csproj 中添加如下代码

代码语言:javascript
复制
<ItemGroup>
    <EmbeddedResource Remove="**/*.xaml" />
</ItemGroup>

详细请看 https://github.com/xamarin/Xamarin.Forms/issues/11101#issuecomment-678329339

另一个方法是我的方法,删除所有的 App.xaml 和 MainWindow.xaml 等文件,如 https://github.com/lindexi/lindexi_gd/tree/96c9063fdba9fe318eb099da67422de5cc9ae5af/XamarinNeller/XamarinNeller.WPF 项目所示,这样也能构建成功。细节请看 WPF 从零手动创建承载 Xamarin Forms 项目

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档