Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to create a Windows Service with Visual Studio for Mac?

I am currently using Visual Studio for Mac and I need to create a background running service application. I realised that the only option that I have is the Console Application in VS Mac. The exe that I will create should run as a Windows Service when deployed to a Windows server or a daemon process in a Linux server.

Can achieve this with Net Core? Is it possible to create a cross platform service process with Visual Studio for Mac?

like image 651
thus Avatar asked Oct 15 '22 15:10

thus


1 Answers

Yes you can. With .net core 3.1, you can create a project using the "Worker Service" template. Then install the Microsoft.Extesions.Hosting.WindowsService nuget package and add UseWindowsService() to the CreateHostBuilder method.

You can see a more detailed answer in this post:Building a Windows service with Worker Services and .NET Core 3.1, part 1: Introduction

like image 64
RCKSTR Avatar answered Oct 21 '22 07:10

RCKSTR