我正在构建一个C# Windows来编译和构建MFC代码,我谷歌了很多,我发现这个线程非常有用的Thread,但我面临两个问题;
(1)与编译相关的,因为我的MFC项目有4种不同的配置,2用于Oracle10和2用于Orace 8i,但是当我在命令行中传递Oracle 10配置时,它不识别它&在oralce 8配置下构建项目。
Oralce 8配置: a)调试b)发布
Oralce 10配置: a)调试(Ora 10) b)发行版(Ora 10)
但是当是在命令行中传递这些值时,例如;
devenv /build Debug (Ora 10) "c:\MySolutions\Visual Projects\MySolution\MySolution.sln“
它不会在给定的配置下从命令行构建它。
2)与C#中的Process相关,我从Process.Start(路径到CMD)调用CMD,它启动命令提示符,但打开窗口后关闭它(我说关闭它是因为我在任务管理器中选中了Process &它不在那里)。
请帮我处理这个。
谢谢
发布于 2010-10-07 06:02:24
关于#2 -张贴一些代码-这是我的:
using System;
using System.Diagnostics;
using System.ComponentModel;
namespace MyProcess
{
class MyProcess
{
public static void Main()
{
string CmdPath, CmdArgument, FrameworkPath;
CmdPath = "cmd.exe";
CmdArgument = "";
FrameworkPath = "C:\\";
ProcessStartInfo CmdLine = new ProcessStartInfo(CmdPath, CmdArgument);
CmdLine.WindowStyle = ProcessWindowStyle.Maximized;
CmdLine.WorkingDirectory = FrameworkPath;
CmdLine.UseShellExecute = false;
Process CmdProcess = new Process();
CmdProcess.StartInfo = CmdLine;
try
{
CmdProcess.Start();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}发布于 2010-10-08 03:49:52
对于您问题的第1部分,我非常肯定您需要在带空格的任何参数周围引用,所以这一行应该如下所示:
devenv /build "Debug (Ora 10)“c:\MySolutions\Visual Projects\MySolution\MySolution.sln”
这假设您的解决方案中有一个名为"Debug (Ora 10)“的配置。
https://stackoverflow.com/questions/3862845
复制相似问题