Core.System.ServiceProcess 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Core.System.ServiceProcess --version 1.0.2                
NuGet\Install-Package Core.System.ServiceProcess -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Core.System.ServiceProcess" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Core.System.ServiceProcess --version 1.0.2                
#r "nuget: Core.System.ServiceProcess, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Core.System.ServiceProcess as a Cake Addin
#addin nuget:?package=Core.System.ServiceProcess&version=1.0.2

// Install Core.System.ServiceProcess as a Cake Tool
#tool nuget:?package=Core.System.ServiceProcess&version=1.0.2                

Core.System.ServiceProcess

NuGet

Support System.Configuration.Install for .NET Core / .NET 5+. Used version from Microsoft Reference Source and comments from .NET Framework DLL v4.0.0.0.

Usage / Documentation

Fixing the ImagePath in the Registry

Somewhere in your parent installer, you will need to correct the path for the ServiceInstaller's assemblyPath (non-case sensitive). With .NET Framework, the entry assembly was always an exe. However, even when running the exe dropped out with a publish, it just bootstraps the DLL and your ImagePath gets written to the registry with a .dll suffix, which will not work on startup (crashes in KERNELBASE.dll).

Use something like this after whatever is setting your assemblyPath today:

private void CorrectAssemblyPath(InstallContext context)
{
    string possibleDll = context.Parameters["assemblyPath"];

    if (possibleDll == null)
    {
        return;
    }

    if (possibleDll.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
    {
        var exe = possibleDll.Substring(0, possibleDll.Length - 4) + ".exe";
        context.Parameters["assemblyPath"] = exe;
    }
}

Assembly Filename

The assembly had to be renamed to System.ServiceProcess.Core.dll because the .NET Core pack comes with an empty (based on analysis with dnSpy) System.ServiceProcess.dll which causes the build to fail by saying none of the types are valid (assembly not referenced error). The compiler does not complain about the two DLLs and just silently ignores the new one.

I renamed it, but all the types are still in the original namespace so this should not affect your code.


More documentation would be appreciated via PRs, but this library is only for backward compatibility with .NET Framework applications being brought into .NET Core and .NET 5+, so it should not be used for new projects.

The interactive service credential prompt is only available when targeting .NET Core 3.0+ since System.Windows.Forms is unavailable in .NET Standard 2.0. This functionality is untested (by me).


Installation

dotnet add package Core.System.ServiceProcess

License

This software is distributed under the terms of the MIT License (MIT).

Authors

Chris Benard / LinkedIn

Special Thanks

Thank you to @flamencist for his encouragement and work on Core.System.Configuration.Install. This project was patterned after his and relies upon it (it is a package reference).

Contributing

Contributions and bugs reports are welcome.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 is compatible.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Core.System.ServiceProcess:

Package Downloads
AACOptics.Net.Utilities

net utilities

KurtsTools

Directory Tools - NewTempDirectory - DeleteDirectory - DirectoryStructureIsEqual - DirectoryIsEqualRecursive - CopyDirectory - BuildDirectoryStructure File Tools - GetMd5Hash - GetConfig Photo Tools - ExifToolWrapper String extensions - FirstWord - SecondWord - FirstWordAndRest - SecondWordAndRest - TrimFirstWord Windows - IsAdministrator - GetServiceControllerByNameOrDisplayName - StopAndDeleteService - CmdRun - ArgumentAnalyzer

XuanYuan.Net.Utilities

net utilities

TryIT.WindowService

Provide method to operate window service, Start, Stop, Restart

Net.Utilities

net utilities

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Core.System.ServiceProcess:

Repository Stars
yar229/WebDavMailRuCloud
WebDAV cloud.mail.ru ...& Yandex.Disk | WebDAV Облако Mail.Ru Сетевой Диск
Version Downloads Last updated
2.0.1 550,130 10/14/2021
2.0.0 1,011 10/14/2021
1.0.2 95,314 10/27/2020
1.0.1 1,154 10/26/2020 1.0.1 is deprecated because it has critical bugs.
1.0.0 3,306 10/26/2020 1.0.0 is deprecated because it has critical bugs.