Standalone Windows Services

%3CLINGO-SUB%20id%3D%22lingo-sub-2223362%22%20slang%3D%22en-US%22%3EStandalone%20Windows%20Services%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2223362%22%20slang%3D%22en-US%22%3E%3CP%3ENow%20that%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fmsix-deployment%2Fsupport-for-windows-services%2Ftd-p%2F196484%23.YFTp4ZQWiwY.link%22%20target%3D%22_self%22%3EWindows%20Services%20are%20supported%3C%2FA%3E%2C%20can%20someone%20provide%20some%20information%20on%20exactly%20%3CSTRONG%3Ehow%20to%20set%20up%20an%20MSIX%20package%20for%20a%20standalone%20traditional%20Windows%20Service%3F%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20know%20Microsoft%20wants%20us%20to%20rewrite%20everything%20using%20.NET%20Core%20Background%20Workers.%20However%2C%20for%20our%20existing%20code%20base%2C%20that%20is%20going%20to%20take%20more%20time%20%26amp%3B%20resources%20than%20we%20have%20at%20the%20moment.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20a%20first%20step%2C%20I%20have%20added%20a%20Windows%20Application%20Packaging%20Project%20to%20my%20solution%20(which%20has%20only%20class%20libraries%20and%20a%20console%20application%20%2F%20windows%20service%20project%20but%20no%20front%20end%20WPF%2C%20etc.).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20a%20last%20step%2C%20I've%20added%20a%20%22MSIX%20build%20and%20package%22%20step%20to%20DevOps.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUnfortunately%2C%20I%20can%20find%20no%20guidance%20on%20how%20to%20get%20from%20the%20first%20to%20the%20last%20step%20for%20Windows%20Services.%20I%20need%20to%20know%20if...%3C%2FP%3E%3COL%3E%3CLI%3Ethe%26nbsp%3BWindows%20Application%20Packaging%20Project%20is%20the%20correct%20first%20step%3C%2FLI%3E%3CLI%3Eif%20so%2C%20how%20to%20add%20the%20Windows%20Service%20to%20it%3C%2FLI%3E%3CLI%3Ewhere%20%26amp%3B%20how%20do%20I%20set%20specific%20Windows%20Service-related%20settings%2C%20e.g.%20Start%20Automatically%2C%20Run-as%20account%2C%20etc.%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBonus%20question%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fmsix%2Fsupported-platforms%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EWhen%20will%20Windows%20Services%20support%20be%20added%20to%20Windows%20Server%3C%2FA%3E%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2227121%22%20slang%3D%22en-US%22%3ERe%3A%20Standalone%20Windows%20Services%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2227121%22%20slang%3D%22en-US%22%3EMost%20likely%20the%20Windows%20Application%20Packaging%20Project%20doesn't%20include%20dedicated%20GUI%20for%20adding%20Win32%20services%20into%20an%20MSIX%20package%2C%20this%20is%20a%20relatively%20new%20feature%20for%20MSIX%20packages.%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20can%20probably%20manually%20tweak%20the%20AppXManifest%20to%20add%20the%20service%20declarations%20in%20the%20package.%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20article%20has%20more%20details%20about%20how%20services%20work%20inside%20an%20MSIX%20packages%2C%20what%20declarations%20you%20need%20to%20add%20in%20the%20package%20manifest%20and%20additional%20details.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fwww.advancedinstaller.com%2Fmsix-windows-services.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.advancedinstaller.com%2Fmsix-windows-services.html%3C%2FA%3E%3C%2FLINGO-BODY%3E
New Contributor

Now that Windows Services are supported, can someone provide some information on exactly how to set up an MSIX package for a standalone traditional Windows Service?

 

I know Microsoft wants us to rewrite everything using .NET Core Background Workers. However, for our existing code base, that is going to take more time & resources than we have at the moment.

 

As a first step, I have added a Windows Application Packaging Project to my solution (which has only class libraries and a console application / windows service project but no front end WPF, etc.).

 

As a last step, I've added a "MSIX build and package" step to DevOps.

 

Unfortunately, I can find no guidance on how to get from the first to the last step for Windows Services. I need to know if...

  1. the Windows Application Packaging Project is the correct first step
  2. if so, how to add the Windows Service to it
  3. where & how do I set specific Windows Service-related settings, e.g. Start Automatically, Run-as account, etc.

 

Bonus question: When will Windows Services support be added to Windows Server?

 

4 Replies
Most likely the Windows Application Packaging Project doesn't include dedicated GUI for adding Win32 services into an MSIX package, this is a relatively new feature for MSIX packages.

You can probably manually tweak the AppXManifest to add the service declarations in the package.

This article has more details about how services work inside an MSIX packages, what declarations you need to add in the package manifest and additional details.

https://www.advancedinstaller.com/msix-windows-services.html
I appreciate your reply, Bogdan. However, I'm really looking for Microsoft to improve the documentation and support for services. Years ago, they had taken Setup projects away from us, sprouting a third party takeover. Now, they are clawing it back, in a way, with MSIX. However, it would appear they still have some work to do to fully support server applications - e.g. Microsoft Server and Windows Services support. What they need to realize is that so many development teams refuse to pay thousands of dollars on packaging. As a result, the server-based products they push out to clients bring an amateur look & feel when they're ugly ZIPs with SC.exe steps, etc.

For others finding this thread, after much searching, I found the official documentation for the manifest.

https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-desktop6-service

HOWEVER, this still appears to apply to a service that is tied to and required by a UWP GUI application.
1-You can create a package with a service and no actual application, although the WAP isn't going to make that easy.
2-As the service would be pushed out just like a traditional setup, perhaps you shouldn't be "pushing on the rope" to use this as a way to push out and stick with what works. At least for now.
While I do enjoy your use of the phrase "pushing on the rope" - development does feel like that quite often - this doesn't really provide much in the way of how to actually get it done.

With regards to the old Setup way, sadly the Visual Studio no longer supports that and the "hacky" reverse integration of the old Setup project types doesn't work with the latest frameworks. I think Microsoft recognizes this; however, they have quite a bit of work ahead of them.

If I'm reading the tea leaves correctly, Windows Server 2022 is likely the going to be first version to fully support MSIX, and it looks like Windows Services in general will have more complete support by then (along with a bunch of other missing features).

Again, I appreciate your help though.