Bug 54671 - XAML in shared project causes Intellisense errors
Summary: XAML in shared project causes Intellisense errors
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Xamarin.Forms ()
Version: 4.4.0 (15.1)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-04-06 21:01 UTC by Edward Brey
Modified: 2017-04-06 21:52 UTC (History)
4 users (show)

Is this bug a regression?: ---
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 Edward Brey 2017-04-06 21:01:11 UTC
For a Xamarin Forms project, the following XAML builds fine regardless of whether it's in a PCL or Shared Project:

<ContentPage x:Class="MyApp.MyView" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:MyApp">
	<Grid />

Although builds always work, the development experience differs between PCL and Shared Project. In a PCL project, everything is fine. In a shared project, however, IntelliSense reports these errors:

The type 'Grid' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
The type 'ContentPage' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

The errors go away after a successful build, but immediately reappear after you save a change to the XAML file. The problem occurs regardless of whether the Custom Tool is MSBuild:UpdateDesignTimeXaml or MSBuild:UpdateDesignTimeXaml.
Comment 1 Daniel Cazzulino 2017-04-06 21:46:28 UTC
Potentially relevant: https://github.com/dotnet/project-system/issues/485 and https://devdiv.visualstudio.com/DevDiv/_workitems/edit/404636

The first one is known to be an issue in some scenarios involving the CPS-based NETStandard project system, which a shared project also uses.

It's being tracked for resolution in a future release. 

If you would like to keep track of it on the VS side, I'd suggest you report the issue from the "Send Feedback" functionality in VS, since this is external to Xamarin.

Thanks for reporting!