Visual Studio doesn't group .xaml and .cs files together in .NET Standard 2.0 Project

I'm using the latest alpha channel and try this:

Create new .NET Standard 2.0 Project
Add reference to Xamarin Forms
Add a couple of new Xaml content pages (one of them I turn into an App.xaml/App.Xaml.cs)
Notice that VS properly groups the Xaml and cs files together in the project structure
Close and reopen VS. Note that the Xaml and cs files are no longer grouped together, and that a duplicate of each of the .xaml files shows in the project tree.

Is this a known issue or am I doing something wrong?

Thanks!
James

Best Answer

Answers

  • mattwardmattward GBMember Xamurai

    Which version of Xamarin.Forms are you using? There is a known problem with Xamarin.Forms 2.4 and .NET Standard projects with Visual Studio for Mac.

    https://bugzilla.xamarin.com/show_bug.cgi?id=59286

  • JamesCadd.7840JamesCadd.7840 USMember
    That sure looks like the issue I'm seeing, but I can't check my Forms version at the moment. I used the default version of Forms as of this morning. What's the fix, wait for a specific version of Forms or VS to become available in nightly? Thanks for the quick response Matt!
  • kingleroygkingleroyg ZAMember ✭✭

    Not really an answer, Does anyone have any workarounds ?? As soon as App.xaml.cs gets detached it means I have to literally startup a new project which is annoying/time-consuming.

  • kingleroygkingleroyg ZAMember ✭✭

    @JamesCadd.7840 said:
    That sure looks like the issue I'm seeing, but I can't check my Forms version at the moment. I used the default version of Forms as of this morning. What's the fix, wait for a specific version of Forms or VS to become available in nightly? Thanks for the quick response Matt!

    @JamesCadd.7840 Did you find a workaround

  • kingleroygkingleroyg ZAMember ✭✭

    And my project code is correct - feels like I'm the only one having this issue

        <Compile Include="Views\LocationPage.xaml.cs">
            <DependentUpon>LocationPage.xaml</DependentUpon>
        </Compile>
    
  • mattwardmattward GBMember Xamurai
    edited October 25

    If you are not using a .NET Standard project, and you are using Xamarin.Forms 2.4 with VS for Mac 7.2, then a workaround for files not nesting is to install the .NET Core 2.0 SDK.

    There should also be a service release for VS for Mac 7.2 that should fix various problems in VS for Mac when using Xamarin.Forms 2.4

  • JonathanDibbleJonathanDibble GBMember ✭✭

    @kingleroyg I have been having the same problem, I have done as suggested by @mattward and it does fix the problem :smile:

  • kingleroygkingleroyg ZAMember ✭✭

    Thanks @mattward Felt I was alone , @JonathanDibble I also created a issue, Realease should be coming soon for mac like Matt said . :smile: https://developercommunity.visualstudio.com/content/problem/137882/xamarin-forms-appxaml-and-appxamlcs-keeps-on-detac.html

Sign In or Register to comment.