flamencist / flamencist/Core.System.Configuration.Install

"Cannot get service name" because options for InstallContext need '-' prefix, not '/'.

オープン
#15 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C#
スター
26
フォーク
12
PR マージ指標
30日以内にマージされた PR はありません

説明

I just ported some software from .NET FrameWork to .NET Core and gratefully used this Nuget package to allow it to install itself as Windows service. I wanted to minimize the amount of work so I didn't want to re-architect my service to the new Worker Service architecture, at least for now.

That didn't work: the install failed with "Cannot get service name" and then rolled back.

It turns out that the problem was that I used a slash '/' instead of a dash '-'.

I don't know if the slash was officially supported in the .NET FrameWork code; the code I'm working on was based on some sample code on the Internet about 10 years ago. So I don't know if I should request that '/' be an alternate prefix character to '-'. I just wanted to post this as an issue because it took me a long time to figure this out, and maybe this is useful for others who run into the same situation.

Fragment of my code after correcting the problem:

```
private static TransactedInstaller CreateTransactedInstaller(Type T)
{
TransactedInstaller result = new TransactedInstaller();

// NOTE: the path option must start with '-', not '/'. The path must be the .exe file, not a .dll file.
string path = "-assemblypath=" + System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;

result.Installers.Add(new InstallerConsoleModule(T, null)); // Constructor checks the type
result.Context = new InstallContext(null, new[] { path });

return result;
}
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start by tracing how InstallContext parses the options passed by CreateTransactedInstaller, especially the -assemblypath value and the reported service-name failure. Reproduce the behavior with the slash and dash prefixes, then establish the intended prefix behavior and cover the result with the relevant test or documentation available in the project.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。