Windows service
将环境变量转化为对应的字符:
private string folder = @"%LocalAppData%";
//将环境变量转化为字符:
string parseFolder = Environment.ExpandEnvironmentVariables(folder);
//将字符转换成路径:
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, parseFolder);
编译即可安装 Windows service 服务
%systemroot%\Microsoft.NET\Framework\v4.0.30319\installutil.exe /u $(TargetPath) 卸载
%systemroot%\Microsoft.NET\Framework\v4.0.30319\installutil.exe $(TargetPath) 安装