我正在构建一个.NET MAUI应用程序,我在尝试构建和运行应用程序时发现了这个错误,但当我运行它附带的模板时,它正常运行,但现在它给出了这个错误:MSB 4057:项目中不存在目标“UpdateGeneratedFiles”。
下面是我的MainPage.xaml文件
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ToDoMAUIClient.MainPage">
</ContentPage>
这是我的项目.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0-android</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>ToDoMAUIClient</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<!-- Display name -->
<ApplicationTitle>ToDoMAUIClient</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.companyname.todomauiclient</ApplicationId>
<ApplicationIdGuid>d0e774d6-0ec2-4307-8314-b664a5b61b51</ApplicationIdGuid>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<None Remove="Platforms\Android\Resources\xml\network_security_config.xml" />
</ItemGroup>
</Project>
我试图寻找此错误MSB4057,它说这是相关的资源路径mispelled或没有找到,即使在微软的错误参考,它是说,但我找不到资源“UpdateGeneratedFiles”或当我在错误Visual Studio中单击时,它被用于导致我的csproj文件的第一行。
1条答案
按热度按时间zzoitvuj1#
这似乎是一个暂时的问题;对我来说是一样的。最近一次是在我修改了splash和icon svg文件,并手动调整了
csproj
文件中的启动画面的BaseSize
之后。我能够通过关闭VS,删除项目主文件夹中的obj
和bin
文件夹,重新启动,清理和重建,然后再尝试启动项目。注意:我使用的是Visual Studio Community 2022(17.8.0)Preview 2.0和.net 8的预览版,但我认为建议应该与早期版本相同。