【发布时间】:2016-04-24 16:47:12
【问题描述】:
我有一个带有 .Droid-Solution 和 SharedProject 的工作 Android 项目。我在手机上启动了该应用程序,效果很好。现在,我刚刚添加了一个空白的 Windows 10 通用解决方案并在此处执行了说明:http://developer.xamarin.com/guides/xamarin-forms/platform-features/windows/installation/universal/
不管怎样……我什么也没做。只是按照说明尝试启动 Windows 10 通用应用程序,但我收到此错误:
"CS0103 C#名称'InitializeComponent'不存在于 当前上下文。”
我用谷歌搜索了几次,但没有找到有用的东西。
我也尝试了这里的示例:https://github.com/jamesmontemagno/Hanselman.Forms 出现同样的错误。
有人知道Xamarin.Forms 和 Windows 10 通用应用程序的这个错误吗?
【问题讨论】:
-
你从哪里得到这个错误?在 Win 10 项目中还是在您大部分代码所在的 common pcl 项目中?如果它是通用项目,那么您需要确保在您的通用 xamarin xaml 文件上设置了适当的构建操作和类型,并可能手动运行自定义工具。如果你能确认错误在哪里,我会回复更详细的说明。
-
我在每个 ContentPage 的 SharedProject 中都遇到错误。我不是很确定,但也许它和这个错误是一样的:xamarin bugzilla。 “确保在常见的 xamarin xaml 文件上设置适当的构建操作和类型并可能运行自定义工具手册”到底是什么意思?
-
好吧,看起来,是同一个bug。我找到了这个thread
@GaborNemeth said: Having the same problem as @"PrabhatGupta.2760" Cannot compile if any XAML page is coming from shared project. I created a sample project to reproduce this issue and attached it to https://bugzilla.xamarin.com/show_bug.cgi?id=36935
标签: c# win-universal-app xamarin.forms initializecomponent