RuntimeIdentifier is not recognized using .NET 8
Asked Answered
A

3

8

I would like to create a new WinUI 3 desktop application using .NET 8. After I initialze the project in Visual Studio, the project is on .NET 6. I change the .csproj file's TargetFramework from net6.0-windows10.0.19041.0 to net8.0-windows10.0.19041.0, but this error pops up. How can I solve this issuewith .NET 8?

The errors:

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

My .csproj file:

<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>

I have tried with .NET 7 and it worked:

<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>

With .NET 8 it doesn't.

Alexipharmic answered 27/11, 2023 at 14:7 Comment(3)
Does this answer your question? NETSDK1083: The specified RuntimeIdentifier "win10-x64" is not recognized. Specifically, see the answer from RyanWhitehot
I saw that, but not help me. I had to search for the answer and I found it.Alexipharmic
So the bit in the linked answer "you can see that you now need to use win-x64." didn't help even though that's exactly what you stated in your answer? Don't just look at the accepted answer.Whitehot
A
10

Well, after a bit of searching, I found the solution, that works for me.

The official Microsoft documentation says:

Use portable RIDs, for example, linux-<arch>, linux-musl-<arch>, osx-<arch>, and win-<arch>.

So I changed the RuntimeIdentifiers and the PublishProfile.

The "10" had to be removed. Like win10-x64 to win-x64.

My modified .csproj is the following:

<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>
Alexipharmic answered 27/11, 2023 at 14:14 Comment(0)
M
1

UPDATE WindowsAppSDK v1.4.4

The workaround UseRidGraph is no longer needed from WindowsAppSDKv1.4.4.


Try these steps to upgrade to .NET 8:

  1. Download and install the .NET 8 SDK.

  2. Edit the *.csproj file.

    • TargetFramework: net8.0-windows10.0.19041.0
    • RuntimeIdentifiers: win-x86;win-x64;win-arm64
    • PublishProfile: win-$(Platform).pubxml
    • Ad UseRidGraph and set it to true.

    For example:

    <PropertyGroup>
      <OutputType>WinExe</OutputType>
      <TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
      <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
      <RootNamespace>WinUI3App</RootNamespace>
      <ApplicationManifest>app.manifest</ApplicationManifest>
      <Platforms>x86;x64;ARM64</Platforms>
      <RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
      <PublishProfile>win-$(Platform).pubxml</PublishProfile>
      <!-- No longer needed from WindowsAppSDK v1.4.4.
      <UseRidGraph>true</UseRidGraph>
      -->
      <UseWinUI>true</UseWinUI>
      <EnableMsixTooling>true</EnableMsixTooling>
      <Nullable>enable</Nullable>
    </PropertyGroup>
    

These steps might be changed/improved in later versions of WindowsAppSDK. Check this from the release notes.

Macaluso answered 27/11, 2023 at 14:27 Comment(0)
S
0

For me the .csproj files were already set to win-x64

I am using WinUI and in the Visual Studio Properties folder I have a file win10-x64.pubxml, I changed the runtime Id in here and it works a treat.

<RuntimeIdentifier>win-x64</RuntimeIdentifier>
Simson answered 5/1 at 10:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.