none
.Net Core Console App produces DLL instead of EXE

    Question

  • Hi, I have a .Net Core console application that generates a dll instead of an exe.  Using VS 2017 RC with .NETCoreApp 1.0 so there is no json file.  How can I get an exe instead? 
    Tuesday, March 14, 2017 10:09 PM

Answers

  • Hi DaveIII,

    Thanks for posting here.

    In Visual Studio we could tweak the project.json by adding a runtimes section to list the environments the app (e.g win10-x64 ) to produces DLL instead of EXE. In Visual Studio 2017, the project.json .NET Core projects will automatically migrate to csproj.
    We could not use that method any more, just as you mention. Since the .csproj and project.json function almost identical, we could add RuntimeIdentifiers in to the .csproj file to achieve our requirement(my is win10-x64 ):

     
     <PropertyGroup>   
      <OutputType>Exe</OutputType>  
      <TargetFramework>netcoreapp1.0</TargetFramework>
      <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers> 
     </PropertyGroup>

    Note: If your TargetFramework is netcoreapp1.1, please change it to 1.0, if it already 1.0, Ignore this note

    Then build the project by using below dotnet command:

    dotnet build -r win10-x64

    In the netcoreapp1.0\win10-x64 folder, you will find the .exe file.

    Hope this can help you.


    MSDN Community Support Please remember to click &amp;quot;Mark as Answer&amp;quot; the responses that resolved your issue, and to click &amp;quot;Unmark as Answer&amp;quot; if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.




    Thursday, March 16, 2017 9:58 AM
  • Hi,

    With the 'netcoreapp1.1' target framework it seems you should build using the 'dotnet publish' rather than 'dotnet build'.

    Hope it helps.

    • Proposed as answer by Pranav Badrinathan Wednesday, June 13, 2018 11:29 PM
    • Marked as answer by DaveIII Thursday, June 14, 2018 1:20 AM
    Friday, March 24, 2017 11:31 AM

All replies

  • Hi DaveIII,

    Thanks for posting here.

    In Visual Studio we could tweak the project.json by adding a runtimes section to list the environments the app (e.g win10-x64 ) to produces DLL instead of EXE. In Visual Studio 2017, the project.json .NET Core projects will automatically migrate to csproj.
    We could not use that method any more, just as you mention. Since the .csproj and project.json function almost identical, we could add RuntimeIdentifiers in to the .csproj file to achieve our requirement(my is win10-x64 ):

     
     <PropertyGroup>   
      <OutputType>Exe</OutputType>  
      <TargetFramework>netcoreapp1.0</TargetFramework>
      <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers> 
     </PropertyGroup>

    Note: If your TargetFramework is netcoreapp1.1, please change it to 1.0, if it already 1.0, Ignore this note

    Then build the project by using below dotnet command:

    dotnet build -r win10-x64

    In the netcoreapp1.0\win10-x64 folder, you will find the .exe file.

    Hope this can help you.


    MSDN Community Support Please remember to click &amp;quot;Mark as Answer&amp;quot; the responses that resolved your issue, and to click &amp;quot;Unmark as Answer&amp;quot; if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.




    Thursday, March 16, 2017 9:58 AM
  • Hi,

    With the 'netcoreapp1.1' target framework it seems you should build using the 'dotnet publish' rather than 'dotnet build'.

    Hope it helps.

    • Proposed as answer by Pranav Badrinathan Wednesday, June 13, 2018 11:29 PM
    • Marked as answer by DaveIII Thursday, June 14, 2018 1:20 AM
    Friday, March 24, 2017 11:31 AM