Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RuntimeIdentifier is not recognized using .NET 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.

like image 381
laszlomocsy Avatar asked May 19 '26 15:05

laszlomocsy


2 Answers

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>
like image 190
laszlomocsy Avatar answered May 22 '26 03:05

laszlomocsy


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.

like image 20
Andrew KeepCoding Avatar answered May 22 '26 04:05

Andrew KeepCoding



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!