简体   繁体   中英

Cannot make executable file of my program with Visual Studio 2017

I've just started using VS 2017 and I'm not able to create a .exe file of my program. I am building the default "Hello World" that is written when I create a new project. I have looked inside every folder of my project's directory and there isn't a single .exe file, and it seems that the compiler is only creating .dll files.

In the Solution's configuration manager, "Configuration" is set to "Release". I have also tried with "Debug" but the result is the same, only .dll is created.

This is the output I get:

Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual 
Studio Options dialog, click on the Package Manager node and uncheck 
'Allow NuGet to download missing packages during build.'
1>------ Rebuild All started: Project: ConsoleApp2, Configuration: Release Any CPU ------
1>ConsoleApp2 -> c:\users\Main\source\repos\ConsoleApp2\ConsoleApp2\bin\Release\netcoreapp2.0\ConsoleApp2.dll
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

Also, when I run the program from Visual Studio by clicking the green triangle it a terminal window pops up with the correct output.

Your problem is that you have created a .NET Core application which does not provide an executable file but only the DLL which can be loaded into the Windows console.

If you want to create an executable, you need to create your project in .NET Framework

You can not change this within the environment now, post project creation, you'll need to create a new project of type .NET Framework (being a console application, wpf, or whatever) and migrate your code over.

After you fix the issue above, your exe file will be located in:

If Debug: ...\\Projects\\ProjectName\\bin\\Debug

or if Release: ...\\Projects\\ProjectName\\bin\\Release

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM