1

I press Ctrl + Shift + N to create a new project. Then I chose Other Languages/Visual C#: Console App (.NET Core) and press OK.

In the .csproj file created, there is a line: <OutputType>Exe</OutputType>. But then, when I press F7 - the output shows this:

1>------ Build started: Project: ConsoleApp3, Configuration: Debug Any CPU ------
1>ConsoleApp3 -> C:\Users\*MyUserName*\source\repos\ConsoleApp3\ConsoleApp3\bin\Debug\netcoreapp2.0\ConsoleApp3.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

So, it created a .dll file. But how do I get the .exe file? Just renaming .dll file doesn't work; it doesn't open then.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sun Serega
  • 63
  • 1
  • 2
  • 8
  • Select .NET Framework (4.x) instead of .NET Core. – H H Jun 05 '18 at 20:53
  • 1) Do you need .NET Core? 2) Why is the .dll insufficient? – Broots Waymb Jun 05 '18 at 20:54
  • @HenkHolterman where is it? – Sun Serega Jun 05 '18 at 21:37
  • @BrootsWaymb i need an .exe file made in C#, that i can execute on another computer. – Sun Serega Jun 05 '18 at 21:39
  • ... on another computer _that has .NET installed_. – H H Jun 05 '18 at 21:40
  • You will find your options under File|NewProject – H H Jun 05 '18 at 21:42
  • @SunSerega - Just because it's an exe doesn't mean that it will run on another computer. Your user will need to have an appropriate version of the framework installed. Same is true for .NET Core (as in your user will need Core installed). There should not be a problem running a Core dll on a system that has Core installed. If you simply do not need to have a Core app, then just build for Framework 4.X (or whatever version suits you) as Henk has said. – Broots Waymb Jun 05 '18 at 21:45
  • 1
    @BrootsWaymb yeah, obviously. I already ran a PABC.Net app on that computer. But i can't run C# program even on my computer (without vs, from folder), because it is not .exe . – Sun Serega Jun 05 '18 at 22:01

1 Answers1

-1

If you want just want to have .exe instead of .dll after building (note, that you need a main function as the library itself without some sort of main cannot be executed) do as follows:

  1. Open the solution

  2. Right-click on project you want to compile into exe -> Properties

  3. Configuration Properties -> General

  4. In Project Defaults change Configuration Type to Application(.exe)

SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34
Kosta
  • 38
  • 7