首页 新闻 会员 周边

如何让 编译构造 一个sln文件?

0
悬赏园豆:50 [已解决问题] 解决于 2012-10-23 10:52

我在网上 找到 如何 编译 生成 一个 解决方案的 代码 了
主要用的是
要用到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();

  }

问题补充: 这个问题 改了 把 debug改成 Debug 就可以了 startInfo.Arguments = "/rebuild Debug " + slnPath; 但是 1楼的朋友 你说的MSBuild 我很感兴趣 能讲解一下吗?
帅员外的主页 帅员外 | 初学一级 | 园豆:18
提问于:2011-01-19 10:05
< >
分享
最佳答案
0

集成和编译 考虑使用msbuild ,功能强大,和vs/tfs集成紧密

收获园豆:50
听说读写 | 小虾三级 |园豆:777 | 2011-01-19 10:25
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册