代码如下:
public void InstallmyService(IDictionary stateSaver, string filepath)
{
using (AssemblyInstaller AssemblyInstaller1 = new AssemblyInstaller())
{
AssemblyInstaller1.UseNewContext = true;
AssemblyInstaller1.Path = filepath;
AssemblyInstaller1.Install(stateSaver);
AssemblyInstaller1.Commit(stateSaver);
}
}
第二次值过来filepath的值是对的,但是给值后 path的值还是第一次的值
考钻牛角尖了 用命令方式会更简单点
https://www.cnblogs.com/loyung/p/6123317.html
每次运行安装程序,都相当于重新运行一个新的程序,而变量肯定是不能跨程序存在的。