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

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

  }

天涯尽头无女友
浏览 508回答 1
1回答

莫回无

集成和编译 考虑使用msbuild ,功能强大,和vs/tfs集成紧密
打开App,查看更多内容
随时随地看视频慕课网APP