【发布时间】:2019-02-12 04:35:38
【问题描述】:
尝试在visual studio中添加Content Page到解决方案时,出现以下错误:
Exception of type 'System.Exception' was thrown.
The project system has encountered an error.
Did not find new element in the hierarchy for item `Views\MyPage.xaml`.
The item would have been added with type "Page".
The project item schema service knows about this item type.
The item does exist in the project file.
添加文件时,我执行以下操作:
Right click on Views in my Xamarin Solution > Add > New Item > Content Page > Add
在 Windows 资源管理器中查看时,有一个文件已创建 MyPage.xaml 但尚未创建 MyPage.xaml.cs 并且未添加到解决方案中
这是一个空白的 Xamarin 共享项目,而且这个错误一直在发生......
这让我发疯了,因为我什至无法添加单个页面
作为一种解决方法,我使用 W. explorer 手动添加文件,然后手动编辑 app.projiitems,但这太荒谬了。
【问题讨论】:
-
Mazzy,我在这个网站上找到了任何东西。也许对你有帮助。
https://forums.xamarin.com/discussion/17661/issue-with-using-xaml-in-a-shared-xamarin-forms-project。如果没有帮助,我试过了。 -
我来自stackoverflow.com/a/47920864/2953322 的“解决方案”基本上只是 - 使用不同版本的 Visual Studio 添加它(我使用 VS 2015 为 VS 2017 中的项目添加它)。不确定这是否适合您;应该比编辑 app.projiitems 快一点...
标签: visual-studio xamarin xamarin.forms