Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Console Application does not generate executable on build

Hello i can not generate an executable from my project (a .NET Core 2.1 Console App).I have checked the output file,the output type is Console Application. It builds successfully ( the program works ) but there is no executable.

I have tried both with debug and release and i have looked into bin\ and obj\ folders for the executable but there is none.
This is how my Bin looks like:

enter image description here

I have looked into Properties->Application and all is set ,still i get no executable.

like image 909
Bercovici Adrian Avatar asked Aug 11 '18 13:08

Bercovici Adrian


People also ask

Can Visual Studio create an exe file?

To build your program and create teh executable file choose Build My Project.exe from the Build menu - "My Project" represents teh name you chose for your project and the extension ".exe" is used to designate that the file being created will be an executable file.

Can C# be compiled to exe?

After a developer writes the C# code, he or she compiles their code. This results in Common Intermediate Language stored within Portable Executable (PE for 32-bit, PE+ for 64-bit) files such as “.exe” and “. dll” files for Windows. These files are distributed to users.


1 Answers

This is a new way .net core environment works. It is not a part of windows (which is the main benefit of creating it) and provided as a standalone package.

You need to start an environment to run .net core app (the same way you do it while running java application if you had a chance).

Try running in a console (this should work not only in windows but in Linux etc.)

dotnet Server.dll

If you'd like to get an exeutive file you need to publish your app (use Visual Studio publish command instead of build. On the publishing screen in settings you need to set up the platform you need executable for and change the deployment mode to "Self-contained". In this case, you should get platform-specific executable.

like image 59
Sergey Prosin Avatar answered Oct 06 '22 02:10

Sergey Prosin