Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a .NET Core Console Application on Mac or Windows

I've created a .NET Core console application. I want to build the app so that I can execute it on Windows or MacOS without dotnet core being installed on the machine. So I need e.g. for windows an exe.

I've read https://docs.microsoft.com/de-de/dotnet/articles/core/tools/dotnet-publish and I know how to compile the application for the different platform(s).

But no executable gets created. What am I missing here and how do I accomplish my goal?

like image 719
dknaack Avatar asked Aug 05 '16 14:08

dknaack


People also ask

Can you run .NET Core on Mac?

Developing ASP.NET Core Applications on a Mac With Visual Studio Code. You can run commands directly from within Visual Studio Code, including dotnet restore and any tools referenced in the project.

How do I run a .NET Core console app on Windows?

Right click the Console App Project and select Publish. Then change Deployment Mode to Self-contained or Framework dependent. . NET Core 3.0 introduces a Single file deployment which is a single executable. Use "framework dependent" if you know the target machine has a .

Can .NET Core run on Windows?

NET platform. ASP.NET Core is the open-source version of ASP.NET, that runs on macOS, Linux, and Windows.


1 Answers

What you need is to create a self-contained application. The link explains how exactly to modify your project.json to do that.

Also note that while a self-contained application does not have a dependency on .Net Core, it may have other dependencies. Specifically on OSX, I believe you will need to install a specific version of openssl from homebrew.

like image 187
svick Avatar answered Oct 02 '22 08:10

svick