在重命名MAUI应用程序项目后,应该如何清理?

后端开发 2026-07-12

先为排版不佳向各位道歉;我并非这里的常客。我通过在解决方案资源管理器中右键单击项目名称来重命名一个.NET MAUI(XAML)项目。现在在一个App.xaml文件里出现了两个错误,问题是这并不是我的App.xaml文件。当我从解决方案资源管理器打开我的App.xaml文件时,我看到的是这个——

<?xml version = "1.0" encoding = "UTF-8" ?>
<Application x:Class="BoomFin.App"
            xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:local="clr-namespace:BoomFin"
            >

    <Application.Resources>

        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/Styles/Colors.xaml" />
                <ResourceDictionary Source="Resources/Styles/Styles.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

    </Application.Resources>

</Application>

The other App.xaml file contains this--

<maui:MauiWinUIApplication
    x:Class="BoomFin.WinUI.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:maui="using:Microsoft.Maui"
    xmlns:local="using:BoomFin.WinUI">

</maui:MauiWinUIApplication>

This other App.xaml file has two errors--

"XLS0414 The type 'maui:MauiWinUIApplication' was not found. Verify that you are not missing ..." which references line 1 of this second App.xaml file, and

"XLS0429 Undefined namespace. The 'using' URI refers to a namespace 'BoomFin.WinUI' that could not be found." which references the xmlns:local on line 6.

How can I repair this damage and resolve those two errors?

解决方案

找到了。几乎所有东西都改名了。唯一没改的是.sln文件。用Windows资源管理器把该文件改名后,项目就顺利构建通过。

站内所有文章版权归属LeftHeroAI导航站,无授权禁止任何主体转载、抄袭、复制内容,亦不得私自架设镜像站点。一经侵权,本站将通过法律途径追责。

相关文章