1

Following the instructions here I:

  • installed visual studio 2017 preview
  • installed .NET Core 2.1 RC1
  • dotnet add package Microsoft.AspNetCore.Hosting.WindowsServices --version 2.1.0-rc1-final

new project ->
select .NET Core on the left ->
select ASP.NET Core Web Application ->
select ASP.NET Core 2.1 on the top ->
select Web Application ->
in program.cs add using Microsoft.AspNetCore.Hosting.WindowsServices; ->
in program.cs change Run() to RunAsService() ->
build release ->
in cmd do dotnet publish

I get:

>dotnet publish
Microsoft (R) Build Engine version 15.7.177.53362 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restoring packages for C:\Temp\VoyDashServer\VoyDashServer\VoyDashServer\VoyDashServer.csproj...
  Generating MSBuild file C:\Temp\VoyDashServer\VoyDashServer\VoyDashServer\obj\VoyDashServer.csproj.nuget.g.props.
  Restore completed in 1.56 sec for C:\Temp\VoyDashServer\VoyDashServer\VoyDashServer\VoyDashServer.csproj.
  You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452
  VoyDashServer -> C:\Temp\VoyDashServer\VoyDashServer\VoyDashServer\bin\Debug\netcoreapp2.1\VoyDashServer.dll
  VoyDashServer -> C:\Temp\VoyDashServer\VoyDashServer\VoyDashServer\bin\Debug\netcoreapp2.1\VoyDashServer.Views.dll
  VoyDashServer -> C:\Temp\VoyDashServer\VoyDashServer\VoyDashServer\bin\Debug\netcoreapp2.1\publish\

That is the result is a dll and not an exe

What am I doing wrong ?

kofifus
  • 17,260
  • 17
  • 99
  • 173
  • Camilo, I followed the instructions here: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/windows-service?view=aspnetcore-2.0&tabs=aspnetcore2x which are supposed to produce an exe even through it's a .net core web app – kofifus May 22 '18 at 23:00

1 Answers1

4

In the last step, instead of dotnet publish do

dotnet publish -c Release --self-contained -r win-x64

That will generate the .exe

zaitsman
  • 8,984
  • 6
  • 47
  • 79