Xamarin.Forms - InitializeComponent doesn't exist when creating a new page

前端 未结 30 2299
不知归路
不知归路 2021-01-30 12:36

I\'m using Visual Studio to try out Xamarin.Forms. I\'m trying to follow the guide: http://developer.xamarin.com/guides/cross-platform/xamarin-forms/xaml-for-xamarin-forms/getti

30条回答
  •  闹比i
    闹比i (楼主)
    2021-01-30 13:01

    It looks like the (re)generation of the blah.xaml.g.cs files is actually the problem. I get this a LOT in shared projects (which is why I don't use them unless I have no other choice). It happens way more in Xamarin Studio than Visual Studio, for me, for some reason. I try not to use XS at all.

    Often unloading one of the other platforms (e.g. if you're building droid, unload ios) and doing a clean and rebuild will fix it.

    You can also try doing something like opening one of the offending .xaml files and changing some of the xaml markup (e.g. adding or changing an x:Name to one of the controls or views). This will force a regeneration of the xaml.g.cs file, and (for me at least) usually solves the problem.

    This really shouldn't be a thing tho.

提交回复
热议问题