What you need is to compile the console application according to the model Self-contained deployment o Self-Contained Implementation .
The advantage is that it will no longer require .Net Core installed on the target machine and therefore it can be executed without the need to do so through the dotnet command. The disadvantage is that the executable will no longer be portable and must be compiled for each specific platform for which you need the executable.
To do it this way edit your file .csproj
and add the tag <RuntimeIdentifiers>
within <PropertyGroup>
and place a list separated by ;
of the Ids of the platforms you want to compile. You can find the complete list of ids here: .NET Core Runtime IDentifier (RID) catalog
Example of .csproj
of a console app
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<RuntimeIdentifiers>win10-x64;ubuntu.16.04-x64</RuntimeIdentifiers>
</PropertyGroup>
</Project>
After this compiles in Release mode and creates as many publication profiles as platforms where you are going to compile.
Be sure to place the profiles in different folders and with different platforms.
Example of Windows publishing profile
Example of a publication profile in Ubuntu
Finally, the files that are ready to be displayed will be in the routes that you placed in the publication profiles. Keep in mind that many files are generated (In my case 118 in Windows and 123 in Ubuntu) because they include not only your app but all the .Net Core necessary for the app to be totally self-sufficient.