如何在创建新页面时修复此错误? [英] How can I fix this error at creating new page?

查看:32
本文介绍了如何在创建新页面时修复此错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Xamarin.Forms 项目.

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.

显示的错误是:

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 

编辑
这是代码:

<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>

推荐答案

我不久前遇到了这个问题.试试下面的这些步骤,它们对我有用.

I encountered this problem a while ago. Try these steps below, they worked for me.

  1. 删除 Xamarin.Forms 并重新安装 Xamarin.forms.

  1. Remove Xamarin.Forms and Re-Install Xamarin.forms.

更新您的所有 Nugets 软件包.

Update all your Nugets packages.

清理和构建解决方案.

如果问题仍然存在:

  1. 重启你的 Visual Studio 和/或你的电脑.

  1. Restart your Visual Studio and/or your PC.

确保您的 Visual Studio 是最新的,并且您没有任何待处理的 Windows 更新.

Make sure your Visual Studio is up-to-date and you do not have any pending windows updates to do.

修复 Visual Studio.

Repair Visual Studio.

您还可以从C:\Users{User}\AppData\Local\NuGet\Cache"中清除 NuGet 缓存

You can also clear NuGet cache from 'C:\Users{User}\AppData\Local\NuGet\Cache'

这篇关于如何在创建新页面时修复此错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆