Search code examples
c#xamlxamarinxamarin.formsvsto

XAML file not working and not recognize when I create a file


I'm trying to create a file (.xaml), a content page, but all files I create this error occurs, how could I fix this problem?

enter image description here

Code:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="NewOutlookAddInCreatio.Views.Contacts.ContactViewPanel">
    <ContentPage.Content>
        <StackLayout>
            <Label Text="Welcome to Xamarin.Forms!"
                VerticalOptions="CenterAndExpand" 
                HorizontalOptions="CenterAndExpand" />
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

Solution

  • You cannot develop VSTO plugins with Xamarin.Forms, that's an incompatible technology. You've probably selected the wrong template for the XAML that you want to create.

    Xamarin.Forms is based on .NET Standard 2.0/2.1 while VSTO plugins require .NET Framework 4.8, which only exists for Windows.

    When you create a new XAML view, make sure the template is from the same technology you're using in your project. Mixing technologies will lead to the error above. Your project is probably using Windows Presentation Foundation (WPF).