我在网上 找到 如何 编译 生成 一个 解决方案的 代码 了主要用的是要用到VS2005提供的一个编译工具 devenv.exe,这个在VS安装目录\Common7\IDE 下的然后 我写了段 函数参数的值 slnPath 是 选取文件的全路径 openFileDialog1.FileName为什么 我这里不能用?请教各位达人了 谢谢各位。 //构造代码sln! public void GouZaoSln(string slnPath) { const string REGISTKEY = "SOFTWARE\\Microsoft\\MSEnvCommunityContent\\ContentTypes\\Addin\\ContentHosts\\1.0\\Visual Studio 2005"; RegistryKey rkey = Registry.LocalMachine; RegistryKey rkey1 = rkey.OpenSubKey(REGISTKEY, true); //获得其安装目录 string visualStudio8Path = rkey1.GetValue("ApplicationPath").ToString(); ProcessStartInfo startInfo = new ProcessStartInfo(visualStudio8Path); //构造slnPath 绝对路径的sln文件! startInfo.Arguments = "/rebuild debug " + slnPath; Process process = new Process(); process.StartInfo = startInfo; process.Start(); process.WaitForExit(); }
添加回答
举报
0/150
提交
取消