Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 or GitHub 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.
This project: https://github.com/onovotny/SampleXamFormsWithNetStandard - reproduces it 100% of the time for me.
About info: https://gist.github.com/kdubau/401a4a42bd922ca4ee12d9adbab9a510
The portable project is also new msbuild "sdk style" format, maybe that's it
The reason there are two files here is that the .NET Core sdk MSBuild imports have a wildcard include for all files that are not C# files:
<None Include="**/*" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
So the .xaml file is included as a None item by default. The project then has an EmbeddedResource Include which adds the .xaml file again.
<EmbeddedResource Include="MainPage.xaml" SubType="Designer" Generator="MSBuild:UpdateDesignTimeXaml" />
So the file is added twice in the project. If you remove the EmbeddedResource project item from the .csproj and re-open the project you can still see the .xaml files included as None items.
The project file I suspect has been edited by hand. In Visual Studio for Windows the Solution Explorer does not show duplicate project items, even though they may exist, whereas Visual Studio for Mac does show them.
If you add a .xaml file using the IDE (Visual Studio for Mac or Visual Studio 2017 on Windows), and then change its Build Action to be EmbeddedResource you will that the .xaml file is excluded from the None items so it is not added as a duplicate:
<None Remove="MainPage.xaml" />
<EmbeddedResource Include="MainPage.xaml" />
Should we consider making VSMac more like VSWin and hide the duplicates?
There are pros and cons either way. VS on Windows is hiding a potential bug in the project. VS on Mac shows you there is a problem.
I think it's unfortunate that this is required in VSfM. There should be no harm in having "None" items in the tree. Perhaps there should be duplicates for other items, like if you have something as Content and Compile, that should be weird. But None should be combinable with everything else,
There's other reasons too -- like I have a global None include to get the solution explorer to show files that are really only conditionally included
Look here for an example:
The files in \Platform are included via None so that they show up in the solution explorer.
Then later, they're conditionally included as a Compile, Resource, etc. I shouldn't have to Remove the None.