为了账号安全,请及时绑定邮箱和手机立即绑定

如何在创建新页面时修复此错误?

如何在创建新页面时修复此错误?

C#
芜湖不芜 2021-11-07 18:59:49
我有一个 Xamarin.Forms 项目。在这个项目中,我已经有一个空白页面,但我添加了一个新页面,这是错误开始显示的时候。显示的错误是:Error XLS0414The 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.xaml1 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.xaml10 编辑这是代码:<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>
查看完整描述

2 回答

?
红糖糍粑

TA贡献1815条经验 获得超6个赞

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

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

  2. 更新所有 Nugets 包。

  3. 清洁和构建解决方案。

如果问题仍然存在:

  1. 重新启动您的 Visual Studio 和/或您的 PC。

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

  3. 修复 Visual Studio。

  4. 您还可以从“C:\Users{User}\AppData\Local\NuGet\Cache”清除 NuGet 缓存


查看完整回答
反对 回复 2021-11-07
?
呼如林

TA贡献1798条经验 获得超3个赞

试试这个:

所有的引用都在<contentPage>标签内。


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


查看完整回答
反对 回复 2021-11-07
  • 2 回答
  • 0 关注
  • 167 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信