I have a C# project in Visual Studio 2019 that I wish to export as a .EXE file. I have already run it in 'Release' Mode, but no .exe turns up in the 'bin' folder - just a '.deps', '.dll', '.pdb', '.runtimeconfig.dev' and a '.runtimeconfig'. I believe I am using a trial for the Enterprise version - does the trial allow this exporting? Thanks.
-
2What's the output type of the project ? – auburg Aug 30 '19 at 15:31
-
1Default output is to bin\Release, not bin. – Hans Passant Aug 30 '19 at 15:33
-
1@RenanBarbosa: that's C++, not C# – Thomas Weller Aug 30 '19 at 15:36
-
1Is this a .net core project? It certianly sounds like it if you have a `.runtimeconfig.dev` file. If so you would use something like `dotnet publish -r win-x64 -c Release --self-contained` – stuartd Aug 30 '19 at 15:36
-
3To expand on what @auburg1 says, right-click on the project (in Solution Explorer) and choose Properties. The Output Type property is on the Application page. You likely have Class Library there. If you want to build (not export, build) an application, you need to have an appropriate Application type chosen. You may want to do some amount of starting over from scratch – Flydog57 Aug 30 '19 at 15:36
-
@Flydog57: he just needs a main() method, not "some amount of starting over from scratch" – Thomas Weller Aug 30 '19 at 15:38
-
"I have already run it in 'Release' Mode" - you can really run it? Even if there's no exe file? How did you do that? – Thomas Weller Aug 30 '19 at 15:38
-
@HansPassant Sorry, that's what I meant – Ironstone Aug 30 '19 at 15:40
-
@stuartd Where would I write that command? Unlike VS Code, I don't actually have a terminal – Ironstone Aug 30 '19 at 15:40
-
@ThomasWeller Inside VS 2019 On the top bar I had 'Release' and 'Any CPU' selected and just clicked on the green 'play' button to run. – Ironstone Aug 30 '19 at 15:41
-
1In the normal Windows command window (cmd.exe) – stuartd Aug 30 '19 at 15:42
-
A .NETCore project creates a DLL, not an EXE. Ready to execute with dotnet.exe. Just like java.exe executes a Java program, python.exe executes a Python program, etc. Google ".net core self-contained app" to learn more. – Hans Passant Aug 30 '19 at 15:48
-
@stuartd Thanks, that works! You can write that as a full answer so I can accept it if you want :) – Ironstone Aug 30 '19 at 15:52
-
@stuartd Is there any way to incorporate this directly into VS 2019 instead of having to save this instruction somewhere and loading up a cmd every time? – Ironstone Aug 30 '19 at 16:11
-
You could add it to the post-build event in the project file but note [this answer](https://stackoverflow.com/a/55169309/43846) _"Add the --no-build parameter to dotnet publish in your post-build event. By default, dotnet publish will run a build, which will trigger post-build events, which will then try to publish again, which will cause an infinite loop that appears to make the build hang."_ – stuartd Aug 30 '19 at 16:24
-
Per `auburg` and `Flydog57`'s comments, you need to change the default output type. More info here https://stackoverflow.com/a/6866648/361842. This is the same result as `Stuartd`'s answer, only that's a command line argument rather than set through the project's config. – JohnLBevan Apr 28 '22 at 09:13
2 Answers
Likely you have a library project as part of the solution and you are looking in the library's bin folder for the exe. It will not be there if that is the case. You will only find the dll in that bin folder.
1 - Right Click your project that youre expecting the output to be an EXE
2 - Click "Open Folder in File Explorer"
3 - you should see a bin folder here, navigate in and you'll find your Release and Debug folders.

- 680
- 4
- 13
-
Thanks, but as I explained I already did that but there were no .exe files. Luckily @stuartd had the solution, and thanks anyway! – Ironstone Aug 30 '19 at 16:04
Per the comments:
Terminology
The process of converting source code to a binary (exe, dll, etc) is called compiling
or building
the code, rather than exporting
it.
Command Line
To build the code from the command line you can run dotnet publish:
dotnet publish -r win-x64 -c Release --self-contained
By targeting the Windows platform (set by the -r
/ --runtime
parameter) a program will become an executable. Other platforms don't use exe
files; so a non runtime specific build would create a dll
as that can be used on a variety of platforms.
CS Project File
- Open your project's
.csproj
file in an editor. - Amend file's
OutputType
toWinExe
(Windows Application) orExe
(Console Application).
IDE UI
You can update the CS Project File by editing it directly, or by navigating the to the relevant settings in your IDE. Assuming that's Visual Studio:
- Open the
Solution Explorer
window - Right-click on the project & click
Properties
- Select the
Application
section - Amend the
Output Type
property toWindows Application
orConsole Application
.

- 22,735
- 13
- 96
- 178