简体   繁体   中英

Windows Service Template for Visual Studio 2017

The Windows Service Template no longer displays by-default for new projects in Visual Studio 2017....and the installer has no 'search' capability.

All this AZURE stuff is great, but I still gotta do normal 'on-prem' work too...and I hate maintaining 2 versions of Visual Studio.

Any thoughts here?

在此输入图像描述

在此输入图像描述

Just checked here. I see project "Windows Service (.NET Framework)" under the Windows Classic Desktop folder under Visual C#.

(Visual Basic has a similar entry.)

Only some templates are shown in parent folders, for more specialist templates you need to be more specific.

But also the search finds both.

NB I selected ".NET Desktop" workload on install, which I see you have not.

在此输入图像描述

VS2017 --> New project --> Visual Basic or Visual C# --> Windows Classic Desktop --> Windows Service

Check the .NET desktop development option in the installer, then click Modify.

Visual Studio 2017安装程序

Also check out this recent post (currently dated 2017-3-30) from MS to do it without the project template:

How to: Write Services Programmatically

The key points are as follows:

  • Create a new project
  • Add "System.dll" and "System.ServiceProcess.dll" as References
  • Create a class inheriting from ServiceBase and create a Program.cs with Main exactly like the template project does

If you are talking Windows Template Studio Universal then You have to install the extension in Visual Studio.

Go to Tools menu >> Extensions & Updates >> Online >>then search for Windows Template Studio

OR go to https://marketplace.visualstudio.com/items?itemName=WASTeamAccount.WindowsTemplateStudio#overview

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM