.NET RID从.NET8更改而来,因此我修改了csproj文件中的PropertyGroup,如下所示。
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>Test</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x64</Platforms>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
我还修改了名称并删除了 pubxml 文件。
之后,在xaml编辑器中,最初正常引用了Microsoft.UI.Xaml.Controls命名空间,但在某个时候,不知道为什么,引用System.Windows.Controls命名空间出现了错误,并且自动补全不起作用。
错误没有描述,但是通过鼠标向上查看Grid的类型,您可以看到它是“System.Windows.Controls.Grid”。
当我编译它时,它工作正常,但由于编辑器中的错误,很难编码。
有谁知道为什么会发生这个错误?