Search code examples
xamarinxamarin.formsmvvmcross

MVVMCross Problem with adding new ContentPage


Could you tell me what I am doing wrong? I've downloaded and installed extension MVVMCross available on https://www.mvvmcross.com/. I've installed it using Tools/Extensions and Updates in VisualStudio 2017 environment. When I created new MVVMCross Multi-Page Xamarin Forms Application then for two existing pages, all works perfectly.

I next needed to add ContentPage, but I have a problem since my new Xamarin Forms ContentPage is not correct: file *.cs is visible in my solution but *.xaml is hidden.

The version of MVVMCross and MVVMCross.binding (core, forms, platform) are 5.2.1 and Xamarin.Forms is 2.3.4.270 and Xamarin.Essentials is 1.5.2.

Could anyone explain to me why I can't add a new page? Thank you in advance.

All steps attached as screens... enter image description here enter image description here enter image description here enter image description here enter image description here


Solution

  • Yes Lucas Zhang - MSFT, you may be right. It looks like a problem with version of Xamarin.Forms or MVVMCross. I'm not sure what more? I had version 15.7.xx of VS2017. After creating new MVVMCross Multi-Page Xamarin.Forms application I have versions: MVVMCross (all libraries) 5.2.1, Xamarin.Forms 2.3.4.270. Then I've not got any errors but I couldn't add new ContentPage.

    Below all my steps which I made myself to resolve this problem:

    1. I've installed VS2019 too, but it has not resolved the problem.

    2. I've updated Xamarin.Forms to the latest stable version 4.6.0.726 but I had on both version of VS the same problem after updating: Error NETSDK1022 Duplicate 'EmbeddedResource' items were included. The .NET SDK includes 'EmbeddedResource' items from your project directory by default. I've read the article on Stack Overflow about this but I couldn't fix the problem. But then it was possible to add correct new ContentPage. In my opinion, the best solution is to update Xamarin.Forms and fix the problem with Duplicate Resource. If you know what to do for this, tell me please.

    3. Finally, I've back to my old version of VS2017 and I've updated it to the latest version 15.9.22. Now, I can create ContentPage and application works but from my point of view doesn't work perfectly. I can add picture to this comment but in my Solution after adding new Page I have two separate files in Page folder: *xaml, *.cs. They don't have connection like other pages (like on the screen below). But it works.
      enter image description here

    I think if I update Xamarin.Forms and I fix Duplicate Resource problem, It will work perfectly.

    I had a lot of problem after updating Xamarin.Forms therefore I've returned and I've installed update of VS2017.

    It would be perfect to describe how we can fix similar problems :-)