我的问题如下:当我尝试安装 Windows 服务时,出现以下错误:
片段:
...
No public installers with the RunInstallerAttribute.Yes attribute could be found in the <path to exe> assembly.
...
我按照这个教程
我有一个Program.fs
文件包含:
[<RunInstaller(true)>]
type public FSharpServiceInstaller() =
inherit Installer()
do
< some logic, doesn't really matter >
这应该足够了,事实上,我什至认为我不需要将public
关键字添加到类型定义中。安装这个可执行文件InstallUtil.exe
给了我与使用以下代码安装它相同的错误:
[<EntryPoint>]
let main args =
if Environment.UserInteractive then
let parameter = String.Concat(args);
match parameter with
| "-i" -> ManagedInstallerClass.InstallHelper [| Assembly.GetExecutingAssembly().Location |]
| "-u" -> ManagedInstallerClass.InstallHelper [| "/u"; Assembly.GetExecutingAssembly().Location |]
| _ -> printf "Not allowed!\n"
else
ServiceBase.Run [| new CreditToolsService() :> ServiceBase |];
0
我曾尝试以管理员和我的普通帐户在 PowerShell、cmd 和 Visual Studio CLI 中运行此脚本,但我一直收到相同的错误。如果有人知道我做错了什么,我将非常感谢一些帮助。