I am running following command to publish .NET CORE 5.0 web api project using command line on windows 10 box.
c:\test\Service>dotnet publish -c release Emp.sln --framework net5.0 /p:DebugType=None /p:DebugSymbols=false --nologo --self-contained --runtime linux-x64 -v m
But I am getting following error:
C:\ProgramFiles\dotnet\sdk\5.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(126,5): error NETSDK1031: It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set SelfContained to false. [c:\test\Service\emp.csproj]
Why I am getting this error when I am specifying --runtime flag? I am able to publish using Visual Studio without any issues.