Bug 55901 - Xaml C# code behind file is not being nested under the Xaml file, after adding new Xaml item to a Shared project
Summary: Xaml C# code behind file is not being nested under the Xaml file, after addin...
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Templates ()
Version: 4.5.0 (15.2)
Hardware: PC Windows
: Normal normal
Target Milestone: 15.5
Assignee: Pierce Boggan [MSFT]
: 56645 ()
Depends on:
Reported: 2017-05-02 23:05 UTC by Ben Beckley
Modified: 2018-02-26 22:06 UTC (History)
12 users (show)

Tags: ac
Is this bug a regression?: Yes
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Ben Beckley 2017-05-02 23:05:58 UTC
Reproduction Steps:
1) Create a new Cross-Platform Shared project
2) Add a new Xaml item to the Shared project
Expected: The code behind c# file should be nested under the Xaml file in the solution explorer
Actual: It is not nested

In the Shared project's .projitem file, the <Compile Include="$(MSBuildThisFileDirectory)Page1.xaml.cs"> entry was missing the <DependentUpon> tag. Also, the <EmbeddedResource> entry was missing <SubType>Designer</SubType>.

env info: https://gist.github.com/BenBeckley/4de4b22d9fdef9b977956df7ddea9e4d
Comment 2 Ben Beckley 2017-05-24 18:45:10 UTC
*** Bug 56645 has been marked as a duplicate of this bug. ***
Comment 3 Joaquin Jares 2017-05-24 19:18:57 UTC
I cannot repro. And the user says that same thing happens in Windows (I assume, Windows projects?). I think this is upstream.
Comment 4 Kayo Hamid 2017-05-24 23:13:13 UTC
My steps installing VS and Xamarin:

- First install Visual Studio
- Then update with Xamarin

I do not know if Ben followed the same steps above, but I reproduce this problem.
Comment 5 Pierce Boggan [MSFT] 2017-06-20 20:50:59 UTC
Thanks for filing this report @Ben/Kayo!

I am now unable to reproduce this issue (nesting + EmbeddedResource definition) using the latest 15.3 builds:

Environment Info: https://gist.github.com/pierceboggan/f1ffd9e92b04565eb494d4138e1a034a
Comment 6 Ben Beckley 2017-07-31 21:03:28 UTC
This is still broken with XVS (ddd8750)


env info: https://gist.github.com/BenBeckley/f6b637040f35d4fe12a40a2cedd5f5e1
Comment 7 davide 2017-10-10 10:55:29 UTC
This bug is also present in the just-released Visual Studio for Mac version 7.2 (xamarin studio works tho!).

mono seems to be also affected, getting an "object reference not set to an instance of an object" on these pages...
Comment 8 Pierce Boggan [MSFT] 2017-10-13 01:57:08 UTC
This issue is now resolved in Visual Studio 2017 version 15.5 when using the latest Xamarin.Forms templates (
Comment 10 Johann Perez 2018-02-20 20:55:38 UTC
Hello, I am having this issue with Visual Studio Community 2017 15.5.6 and the "Xamarin Templates" extension I have is 1.0.49 but I cannot find a way to update it. How do you get the new Xamarin.Forms template?

Thank you!
Comment 11 Ashish Patil 2018-02-24 11:47:54 UTC
Just updated the Visual Studio Community 2017 to latest version 15.5.6 ***. Still I am getting the same issue. Checked Xamarin.Forms templates version in Tools -> Extensions and Updates, It is 1.0.49. And Automatically update this extension checkbox is checked. 

If there is updated available, how can I update it? There are only two options in Disable and Uninstall. No update option in Tools -> Extensions and Updates.

Please update us on this. Updating .projitem file every time after adding new page in frustrating.
Comment 12 Ashish Patil 2018-02-24 11:49:53 UTC
Now updated to version 15.5.7. and I am facing same problem!

Please help to resolve the issue.
Comment 13 Johann Perez 2018-02-26 21:23:43 UTC
Hello! In my case installing UWP development tools was the solution. 

taken from: https://developercommunity.visualstudio.com/content/problem/160939/bug-adding-xaml-content-page-to-shared-project-xam.html
Comment 14 Pierce Boggan [MSFT] 2018-02-26 22:06:11 UTC
Hi all,

We have a bug tracking this that Johann linked in Comment #13. Developer Community is the best place to file and track Xamarin issues for Visual Studio. :)

The issue is actually a .NET project system issue, filed here: