Creating ConsoleApplication for Mac on a Mac

SunnyTheOne 1 Reputation point
2022-04-07T19:15:28.007+00:00

Hi Community

I just created a Project (Console Application) with aprox. 3000 Codelines and I'm super happy. I did this on Visual Studio for Mac. For my Windows PC I can create a .exe File. So far so good.

But I can't find any how to's / step by step tutorials on how I can create a native mac console application from my mac for my mac? The only thing I find is a tutorial how to create a Mac Form Application... but that's not what I wanted to do.

Many thanks for you input.

.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,119 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Rob Caplan - MSFT 5,412 Reputation points Microsoft Employee
    2022-04-07T21:52:41.407+00:00

    Visual Studio for Mac includes a .Net Console App template under Web and Console / App / Console Application.

    Tutorial: Create a .NET console application using Visual Studio for Mac

    It doesn't sound like this is what you're looking for, but if you want to call MacOS API via the Xamarin.Mac bindings see:
    Xamarin.Mac bindings in console apps

    0 comments No comments

  2. Bruce (SqlWork.com) 56,026 Reputation points
    2022-04-08T03:25:42.257+00:00

    Just like other Mac languages node, python, ruby, etc you run them with a program. Fortunately, dotnet builds a small executable, that loads and runs your .net code.

    to create a console app:

    dotnet new console

    If you build and look in the bin folder, there should be file with no extension named after the project (Unix does use a file extension for executables). This is the exe, it will load the dlls in the folder and call main. The build also adds the execute bit to this file.

    Note: Currently build to native is only supported for IOS, but may appear in future versions.

    0 comments No comments