找到Windows服务中的 ProjectInstaller.cs文件
双击打开
按F7跳转到代码区域
在 ProjectInstaller构造函数中输入以下代码即可
public ProjectInstaller()
{
InitializeComponent();
//动态Windows服务名称
serviceInstaller1.ServiceName = ReadWriteConfig.GetServiceName();
serviceInstaller1.DisplayName = ReadWriteConfig.GetServiceName();
serviceInstaller1.Description = ReadWriteConfig.GetServiceName();
}