dotnet publish osx-x64 doesn't generate executable

Viewed 512

I have an Avalonia project I'm tried to build for mac. But when I use dotnet publish to generate the build for osx, there is no executable file generated. It generates a .dll file with the same name as the program (same name as the executable should be) and also a file with no extension with the same name. To do so I use

dotnet publish "VisualStudio solution path" -c Release -f netcoreapp3.1 -r osx-x64 -p:UseAppHost=True --self-contained true -o "outputPath"

As per I read here I also added UseAppHost True in my project properties. They look like this:

<PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <RuntimeIdentifiers>win7-x64;osx-x64;ubuntu.16.04-x64</RuntimeIdentifiers>
    <Nullable>enable</Nullable>
    <LangVersion>preview</LangVersion>
    <UseAppHost>True</UseAppHost>
  </PropertyGroup>

I'm at a loss as to how to get dotnet publish to generate an actual executable file for mac. Does anyone know what I'm doing wrong and what I need to do? Thanks.

Edit: I'm doing this on windows 10.

2 Answers

use

  <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <RuntimeIdentifiers>win7-x64;osx-x64;ubuntu.16.04-x64</RuntimeIdentifiers>
    <Nullable>enable</Nullable>
    <LangVersion>preview</LangVersion>
    <UseAppHost>True</UseAppHost>
 <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
Related