⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@AdmiralSnyder
Copy link
Contributor

We tried installing a service executable converted from .net framework 4.8 to net10 using installUtil, as suggested here, but that errored because of a BadImageFormatException:

Beim Initialisieren der Installation ist eine Ausnahme aufgetreten:
System.BadImageFormatException: Die Datei oder Assembly "file:///D:\Publish\NexusCbfcLite\Nexus.BackgroundService.exe" oder eine Abhängigkeit davon wurde nicht gefunden. Im Modul wurde ein Assemblymanifest erwartet.

I kinda expected that since ServiceUtil is a .net framework process.

using sc create worked, though. documentation shoud reflect this (after this is cleared to be correct, of course)

Summary

Describe your changes here.

Fixes #Issue_Number (if available)

…net10? net core? service executables

We tried installing a service executable converted from .net framework 4.8 to net10 using installUtil, as suggested here, but that errored because of a BadImageFormatException:

> Beim Initialisieren der Installation ist eine Ausnahme aufgetreten:
System.BadImageFormatException: Die Datei oder Assembly "file:///D:\Publish\NexusCbfcLite\Nexus.BackgroundService.exe" oder eine Abhängigkeit davon wurde nicht gefunden. Im Modul wurde ein Assemblymanifest erwartet.

i kinda expected that since ServiceUtil is a .net framework process.

using `sc create` worked, though. documentation shoud reflect this (after this is cleared to be correct, of course)
@AdmiralSnyder AdmiralSnyder requested a review from a team as a code owner January 14, 2026 20:35
Copilot AI review requested due to automatic review settings January 14, 2026 20:35
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jan 14, 2026
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jan 14, 2026
@AdmiralSnyder
Copy link
Contributor Author

oh. i just now realized that creating issues on this repo is possible now - so this should probably have been an issue ... well, since it's containing the change in case the question i asked turns out to be correct, i'll leave it a PR.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the ServiceBase documentation to replace the recommendation to use InstallUtil.exe with sc create for installing Windows services. The change addresses the fact that InstallUtil.exe is a .NET Framework tool that doesn't work with .NET Core/.NET 10 executables.

Changes:

  • Replaced the reference to InstallUtil.exe with sc create as the recommended method for installing services

You do not have to implement <xref:System.ServiceProcess.ServiceBase.OnStart%2A>, <xref:System.ServiceProcess.ServiceBase.OnStop%2A>, or any other method in <xref:System.ServiceProcess.ServiceBase>. However, the service's behavior is described in <xref:System.ServiceProcess.ServiceBase.OnStart%2A>, so at minimum, this member should be overridden. The `main()` function of the executable registers the service in the executable with the Service Control Manager by calling the <xref:System.ServiceProcess.ServiceBase.Run%2A> method. The <xref:System.ServiceProcess.ServiceBase.ServiceName%2A> property of the <xref:System.ServiceProcess.ServiceBase> object passed to the <xref:System.ServiceProcess.ServiceBase.Run%2A> method must match the <xref:System.ServiceProcess.ServiceInstaller.ServiceName%2A> property of the service installer for that service.
You can use `InstallUtil.exe` to install services on your system.
You can use `sc create` to install services on your system.
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence lacks completeness for a documentation change. It should provide more context about when to use sc create versus InstallUtil.exe, particularly noting that InstallUtil.exe only works with .NET Framework applications, while sc create works with both .NET Framework and modern .NET (Core, .NET 5+). The sentence should end with a period per coding guidelines.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +78 to 79
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line contains only whitespace and should be removed. Empty lines in XML documentation should not contain trailing spaces.

Suggested change

Copilot uses AI. Check for mistakes.
You do not have to implement <xref:System.ServiceProcess.ServiceBase.OnStart%2A>, <xref:System.ServiceProcess.ServiceBase.OnStop%2A>, or any other method in <xref:System.ServiceProcess.ServiceBase>. However, the service's behavior is described in <xref:System.ServiceProcess.ServiceBase.OnStart%2A>, so at minimum, this member should be overridden. The `main()` function of the executable registers the service in the executable with the Service Control Manager by calling the <xref:System.ServiceProcess.ServiceBase.Run%2A> method. The <xref:System.ServiceProcess.ServiceBase.ServiceName%2A> property of the <xref:System.ServiceProcess.ServiceBase> object passed to the <xref:System.ServiceProcess.ServiceBase.Run%2A> method must match the <xref:System.ServiceProcess.ServiceInstaller.ServiceName%2A> property of the service installer for that service.
You can use `InstallUtil.exe` to install services on your system.
You can use `sc create` to install services on your system.
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is incomplete as it doesn't address the many other references to InstallUtil.exe throughout the System.ServiceProcess namespace documentation. Files like ServiceProcessInstaller.xml, ServiceInstaller.xml, and ns-System.ServiceProcess.xml still reference InstallUtil.exe. A comprehensive update should either maintain guidance for both tools (with appropriate notes about .NET Framework vs. modern .NET compatibility) or update all related documentation consistently.

Suggested change
You can use `sc create` to install services on your system.
You can use the `sc create` command to install services that target modern .NET, or use `InstallUtil.exe` to install services that target the .NET Framework.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates that the PR has been added by a community member needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant