Mcs*_*csy 7 .net xaml csproj winui-3 .net-8.0
我想使用 .NET 8 创建一个新的 WinUI 3 桌面应用程序。在 Visual Studio 中初始化项目后,该项目位于 .NET 6 上。我将 .csproj 文件的 TargetFramework 从 更改为net6.0-windows10.0.19041.0,net8.0-windows10.0.19041.0但弹出此错误。如何使用 .NET 8 解决此问题?
错误:
NETSDK1083: The specified RuntimeIdentifier "win10-x86" is not recognized
NETSDK1083: The specified RuntimeIdentifier "win10-x64" is not recognized
NETSDK1083: The specified RuntimeIdentifier "win10-arm64" is not recognized
Run Code Online (Sandbox Code Playgroud)
我的.csproj文件:
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>SudokuEngineApp</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<PublishProfile>win10-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
我尝试过 .NET 7 并且它有效:
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
而 .NET 8 则不然。
好吧,经过一番搜索,我找到了适合我的解决方案。
微软官方文档说:
使用便携式 RID,例如
linux-<arch>、linux-musl-<arch>、osx-<arch>和win-<arch>。
所以我改变了RuntimeIdentifiers和PublishProfile。
“10”必须被删除。喜欢。win10-x64win-x64
我的修改.csproj如下:
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>SudokuEngineApp</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
851 次 |
| 最近记录: |