"Cannot get service name" because options for InstallContext need '-' prefix, not '/'.
还没有人认领这个 Issue。
评估
调研方向
先追踪 InstallContext 如何解析 CreateTransactedInstaller 传入的选项,尤其是 -assemblypath 的值以及报告的服务名称相关失败。使用斜杠和短横线前缀重现该行为,然后确定预期的前缀行为,并通过项目中现有的相关测试或文档覆盖这一结果。
由索引模型根据 Issue 内容生成。
描述
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;
}
- 主要语言
- C#
- 星标
- 26
- 派生
- 12
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
flamencist/Core.System.Configuration.Install 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 4/5 3-5 天 新手友好度 30/100
flamencist/Core.System.Configuration.Install#11 · 2 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 20/100
flamencist/Core.System.Configuration.Install#9 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
flamencist/Core.System.Configuration.Install#8 · 3 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
flamencist/Core.System.Configuration.Install#1 · 3 条评论 · 1 个 reaction ·
查看 flamencist/Core.System.Configuration.Install 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
-
type/automation type/tech-debt
难度 2/5 1-3 小时 新手友好度 78/100
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
-
t/bug
难度 2/5 1-3 小时 新手友好度 82/100
-
ci-failure-cause test-failure
难度 2/5 1-3 小时 新手友好度 82/100