问题
I have a Xamarin.Forms Project.
In this project I already had a blank page but I added a new one, is when the error started showing.
The errors that show are:
Error XLS0414
The type 'ContentPage' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
TaskX.Android New.xaml
1
Error XLS0414 The type 'StackLayout' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
TaskX.Android New.xaml
10
EDIT
This is the code:
<ContentPage>
x:Class="TaskX.New"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TaskX"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
<StackLayout>
</StackLayout>
</ContentPage>
回答1:
I encountered this problem a while ago. Try these steps below, they worked for me.
Remove Xamarin.Forms and Re-Install Xamarin.forms.
Update all your Nugets packages.
Clean and Build solution.
If the problem persists :
Restart your Visual Studio and/or your PC.
Make sure your Visual Studio is up-to-date and you do not have any pending windows updates to do.
Repair Visual Studio.
You can also clear NuGet cache from 'C:\Users{User}\AppData\Local\NuGet\Cache'
回答2:
Try this:
All the referencing will be inside <contentPage>
tag.
<ContentPage
x:Class="TaskX.New"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TaskX"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<StackLayout>
</StackLayout>
</ContentPage>
来源:https://stackoverflow.com/questions/51600664/how-can-i-fix-this-error-at-creating-new-page