Search code examples
c#windowsmauipublish.net-8.0

MAUI .NET 8 windows publishing error: RuntimeIdentifier not recognized


I've been trying to publish my app for windows, but it keeps me giving the same error:

The specified RuntimeIdentifier 'win10-x64' is not recognized. See https://aka.ms/netsdk1083 for more information.

Here is a step-by-step of what I'm doing:

Publish > Sideloading (automatic updates not checked) > Skip package signing > Publising profile MSIX-win10-x64.pubxml

Now, I know from this comment that win10-x64 is no longer available and that I should use win-x64 instead. This article says that I can solve the problem by simply editing the <RuntimeIdentifier>win10-x64</RuntimeIdentifier> in the .csproj file to make it say win-x64 ("The RuntimeIdentifier 'win-x64' is invalid.").

Since I didn't have that tag in the file, I added it but it didn't work.

Finally, I copy-pasted this property group and it didn't give me any errors.

<PropertyGroup Condition="'$(IsPublishing)'  == 'true' And '$(TargetFramework)' == 'net8.0-windows10.0.19041.0'">
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>

The publishing still doesn't work and doesn't recognize win10-x64.


Solution

  • As suggested by @liyun-zhang-msft, I've tried publishing the app via CLI: I followed the article step by step, creating a certificate and configuring the project settings (=adding the <PropertyGroup>'s to the .csproj file).

    At first, I ran dotnet publish -f net8.0-windows10.0.19041.0 -c Release -p:RuntimeIdentifierOverride=win-x64 and it didn't work. That's because in the same article there is a warning saying that the dotnet publish should be scoped only to the single app project you want to publish. In fact, the other projects were throwing errors such as "restore and make sure net8.0-windows... is in the TargetFrameworks", which didn't make sense since I already included it in the project file.

    So here is the final answer:

    dotnet publish .\{project name} -f net8.0-windows10.0.19041.0 -c Release -p:RuntimeIdentifierOverride=win-x64