views:

45

answers:

2

I'm building a C# Windows App to compile & Build MFC Code i googled a-lot and I found this thread very useful Thread but i'm facing 2 problems;

1) Related To Compile as my MFC project have 4 different configuration 2 for Oracle 10 & 2 for Orace 8i but when i pass Oracle 10 Configuration in command-line it doesn't recognize it & builds the project at oralce 8 Configuration

Oralce 8 Configuration : a) Debug b) Release

Oralce 10 Configuration : a) Debug (Ora 10) b) Release (Ora 10)

but when is pass these values in command line for e.g;

devenv /build Debug (Ora 10) "c:\MySolutions\Visual Studio Projects\MySolution\MySolution.sln"

it doesn't build it at the given configuration from command-line

2) Related to Process Class in C# i'm calling CMD from Process.Start(Path to CMD) it starts the Command-Prompt but after opening the windows it closes it (I said closes it because i checked the Process Tab in task-manager & it wasn't there).

Please Help me with this.

Thanks

A: 

For #2 - Post some code - here's mine:

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);
           }
        }
    }
}
Jeff
ProcessStartInfo CmdLine = new ProcessStartInfo(CmdPath, CmdArgument);CmdLine.WindowStyle = ProcessWindowStyle.Maximized;CmdLine.WorkingDirectory = FrameworkPath;CmdLine.UseShellExecute = false;Process CmdProcess = new Process();CmdProcess.StartInfo = CmdLine;CmdProcess.Start();
KhanZeeshan
Ok - modified example to use your code, I had to initialize CmdPath, CmdArgument, and FrameworkPath. Next time post a code sample that at least compiles and we can fix it -
Jeff
A: 

For Part 1 of your question, I'm pretty sure you need quotes around any arguments with spaces, so the line should be like this:

devenv /build "Debug (Ora 10)" "c:\MySolutions\Visual Studio Projects\MySolution\MySolution.sln"

This assumes you have a configuration called "Debug (Ora 10)" in your solution

Jeff