Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin.Forms Previewer - An android application project must reference a project containing this xaml file in order to render in the previewer

I'm getting the following error when trying to preview XAML documents via the Xamarin.Forms Previewer while in Visual Studio.

An Android Application project must reference the project containing this xaml file in order to render in the previewer.

I've tried

  1. Closing the XAML file and reopening
  2. Verified the Java SDK path locations are correct
  3. Clean and Rebuilding Solution

Im using Xamarin 4.5.0.486, Android SDK 7.3.1.2, Xamarin.iOS and Xamarin.Mac SDK 10.10, Visual Studio Community Version 2017

enter image description here

like image 940
Kusal Dissanayake Avatar asked Sep 01 '17 12:09

Kusal Dissanayake


People also ask

How do I enable Xamarin forms previewer?

You can open the XAML Previewer by clicking the arrows on the split view pane. If you want to change the default split view behavior, use the Tools > Options > Xamarin > Xamarin. Forms XAML Previewer dialog. In this dialog, you can select the default document view and the split orientation.

How do I preview files in XAML?

To open it, go to Debug > Windows > XAML Live Preview. Or, select the Show in XAML Live Preview button in the application toolbar.

Does Xamarin forms have a designer?

The Xamarin. Android Designer allows developers to create and modify declarative layouts visually, without requiring hand-editing of XML files. The Designer also provides real-time feedback that lets the developer evaluate UI changes without having to redeploy the application to a device or to an emulator.


1 Answers

Check your android project and make sure the dll of your PCL/.net standard project is reference. In my own case, its referenced but shows a yellow color. I deleted the reference and re-reference by right clicking on the android project>projects>solution>select the PCL/.net standard project > ok

enter image description here

like image 181
Ellix4u Avatar answered Sep 28 '22 16:09

Ellix4u