dotnet publish not detected runtimeidentifiers

459 Views Asked by At

In my .csproj file, i have the following written:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <RootNamespace>SCR_Number_Generator</RootNamespace>
    <RuntimeIdentifiers>win-x64;osx-x64</RuntimeIdentifiers>
  </PropertyGroup>
</Project>

This is because I want to build a single/self contained executable for my app. I run the following command: dotnet publish -p:PublishSingleFile=true --no-self-contained and it gives the following error:

/usr/local/share/dotnet/sdk/6.0.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(102,5): error NETSDK1097: It is not supported to publish an application to a single-file without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set PublishSingleFile to false. [/Users/lincolnmuller/SCR-Random-Number/SCR-Number-Generator/SCR-Number-Generator.csproj]

When i do a single RuntimeIdentifier, it detects it. But it doesn't detect RuntimeIdentifiers. How do I fix this?

0

There are 0 best solutions below