Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Core console application is not creating an EXE file

I'm trying to publish a .NET Core console application following this tutorial, but when I publish, I don't get an executable file in the PublishOutput folder (I get a DLL file). I've also read this article.

My project file looks like this:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>

</Project>

It seems pretty easy and straightforward, but what am I doing wrong?

like image 543
Matt M Avatar asked Dec 05 '25 10:12

Matt M


2 Answers

Yeah, this is a weird one. I am still trying to work through it. I did find there seems to be a delay in getting the functionality from the CLI to Visual Studio 2017: This Stack Overflow article talks about that.

Also, there is ongoing confusion around exactly what Output type means since it is not what we all think. This GitHub issue talks about it.

I tried this on the Hello, World! template that Visual Studio provides. Change your .csproj file to the following:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <!--<OutputType>Exe</OutputType>-->
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
  </PropertyGroup>
</Project>

I don't think the OutputType matters more than the RuntimeIdentifiers property.

Then using the console, run dotnet restore followed by dotnet publish -c release -r win10-x64

This should generate an EXE file under \bin\Release\netcoreapp1.1\win10-x64\publish

View this article from the same person in your first link.

like image 28
Brian Avatar answered Dec 08 '25 04:12

Brian