It is "not supported" to build or publish a self-contained application without specifying a RuntimeIdentifier

Viewed 5489

Using the latest Visual Studio 2019 I am trying to publish a Msix installer for a DotNetCore 3.1 WPF application. The application builds and runs correctly, but when I try to publish the application I get this error

It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier.

My UI projects csproj looks like this.

<PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <UseWPF>true</UseWPF>
    <RuntimeIdentifier>win10-x64</RuntimeIdentifier>
    <SelfContained>false</SelfContained>
</PropertyGroup>

How can this issue be fixed?

Edit: So it turns out that the issue only occurs when I include my self hosted asp.net core project in the gui project that I am trying to package.

What could be causing this issue? Is it just not supported to package that kind of project for some reason?

1 Answers

Please delete the RuntimeIdentifier and SelfContained setting in your PropertyGroup, then input dotnet publish -f netcoreapp3.1 -r win10-x64 --self-contained false in the cmd.exe

Related