Forum Visual Studio

Using DesignInstance in XAML produces an error in VS but runs correctly

I'm working on a Xamarin Forms application that sets the BindingContext of my views in code. I was looking for ways to setup my XAML so that it would autocomplete properties from my ViewModels. I had been using some hack solution for this until I recently came across an article that described using the DesignInstance attribute. This works great except that Visual Studio reports the attribute as an error. In the Error List the description is:

MarkupExtension not found for d:DesignInstance (there is no error code for this error)

If I go to the XAMl file and hover over the error the description there is:

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

The strange part is that despite these errors my application runs fine. My question is: Is there anyway to ignore or fix this error?

In the short term it's mostly just an annoyance but I'm worried about using this in the future with automated builds. I could see this causing the builds to fail when really they are fine.


<ContentPage xmlns=""
             d:DataContext="{d:DesignInstance viewModels:MySuperAwesomeViewModel}"
        <!-- My content -->


Sign In or Register to comment.