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)   安装

posted @ 2015-02-03 20:44  魔力鸟  阅读(180)  评论(0编辑  收藏  举报