app*_*641 3 .net c# xaml winui-3
.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”。
当我编译它时,它工作正常,但由于编辑器中的错误,很难编码。
有谁知道为什么会发生这个错误?
更新
从WindowsAppSDKv1.4.4UseRidGraph
开始不再需要该解决方法。
以下是适合我从 .NET 7 升级到 .NET 8 的步骤:
安装.NET 8 SDK。
编辑您的 *.csproj 文件。
TargetFramework
:net8.0-windows10.0.19041.0RuntimeIdentifiers
: win-x86;win-x64;win-arm64PublishProfile
: win-$(平台).pubxmlUseRidGraph
并将其设置为true
.例如:
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>WinUI3App4</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
<UseRidGraph>true</UseRidGraph>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
<Nullable>enable</Nullable>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
这些步骤可能会在更高版本的WindowsAppSDK中更改。从发行说明中检查这一点。
归档时间: |
|
查看次数: |
1868 次 |
最近记录: |