我用PCL选项创建了一个新的Xamarin表单项目,并添加了一个名为MainPage的详细页面。一旦添加,我就会收到错误,说MainPage已经存在。我正在使用VS2017和最新版本的Xamarin。
Error CS0101 The namespace '' already contains a definition for 'MainPage' \obj\Debug\xxxxxxMainPage.xaml.g.cs
任何帮助都很感激。谢谢。
编辑:
https://forums.xamarin.com/discussion/89346/forms-master-detail-page-generation-is-broken
这已经得到了答案。
发布于 2017-04-03 08:14:50
有一些错误创建了一个MasterDetailPage
让我们创建一个名为MyApp的项目和一个名为Page1的MasterDetailPage
1)看起来,添加的页面有错误的命名空间。因此,更改添加的页上的命名空间。
Visual向新页命名空间MyApp.Page1添加
Page1.xaml.cs - change the Namespace to be just MyApp
Page1Detail.xaml.cs - Change the namespace to be just MyApp
Page1Master.xaml.cs - Change the namespace to be just MyApp
Page1MenuItem.cs - Change the namespace to "MyApp"
2)我还注意到,在Page1Master.xaml.cs中,引用MenuItems是错误的。
It says Page1MenuItems = new ObservableCollection...
Change that to be just
MenuItems = new ObservableCollection...
这对我来说很有用
希望它能帮上忙
https://stackoverflow.com/questions/43003957
复制