Link to home
Start Free TrialLog in
Avatar of jgordin
jgordin

asked on

C#: directories under bin: Debug and Release; exec files

i am using microsoft vs. there are two directories under bin: Debug and Release. I thought the executable (non debug version) would be in a Release directory. The type of the file is Application. Nothing happens when I try to exec that file but I am able to exec the same file in the Debug directory. can you please shed light on that?
thanks.
Avatar of JimBrandley
JimBrandley
Flag of United States of America image

Did you run a release build? if so, there should be be a file called YourProjectName.exe in the release directory. That's the executable.

Jim
Avatar of jgordin
jgordin

ASKER

i tried to execute bin/Release/projName.exe from c# but nothing happens. the type of the file is XML Configuration File.
You wouldn't execute that file from C# - just double-click, as any other executable. The config files are XML that allow you to set various parameters your executable needs without requiring a re-compile.

Jim
Avatar of jgordin

ASKER

which file i can execute from c#?
Do you mean from inside visual studio? If so, you can start either one Select Debug or Release in the toolbar dropdown, and tell it to start debugging.

Jim
Avatar of jgordin

ASKER

i am trying to call *.exe file (c# app1) from c# app2.
What does your invocation code (code to launch the other exe) look like?
Avatar of jgordin

ASKER

string executable = "A:\\Projects\\bin\\Release\\ABC.exe";
            Process process1                            = new Process();
            process1.StartInfo.UseShellExecute          = false;
            process1.StartInfo.CreateNoWindow           = false;
            process1.StartInfo.WindowStyle              = ProcessWindowStyle.Hidden;
            process1.StartInfo.FileName                 = executable;
            process1.Start();
            process1.WaitForExit();
            int exitCode = process1.ExitCode;
Looks OK to me. From the main menu, select Debug/Exceptions. From the ensuing dialog, tell it to break on exceptions. Then run the calling program from the debugger and see if it is throwing an exception somewhere.
Avatar of jgordin

ASKER

nothing happens. i tried to execute that file, *.exe, from DOS (run/cmd) screen but nothing happens either. any ideas?
For debugging purposes I would change the Window Style so that it is not hidden. You can also redirect the output/error streams so that app2 can read them from app1.

Use the following code to do that:
process1.StartInfo.RedirectStandardOutput = true;
process1.StartInfo.RedirectStandardError = true;

To read them use
process1.StandardOutput.ReadLine();
process1.StandardError.ReadLine();
Can you copy the contents (names, sizes, etc - not the files themselves) of the release directory and post what you see there?
If you have the source for app1 then I would step through it with the debugger and find out what is happening.

Do you know what app1 is supposed to do? Maybe it writes its data to file or other location.
Avatar of jgordin

ASKER

files in release directory:
                                                Type
1. ProjectName           50KB    Application
2. ProjectName           75KB   Program Deb
3. ProjectName.exe    2KB     XML
Avatar of jgordin

ASKER

app1 just has to execute app2. i stepped thru it .  process1.Start() doesnt do anything.
Avatar of jgordin

ASKER

app2 writes data into output directory.
ASKER CERTIFIED SOLUTION
Avatar of JimBrandley
JimBrandley
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jgordin

ASKER

i set:

process1.StartInfo.UseShellExecute          = true;
 process1.StartInfo.CreateNoWindow           = true;

i can see that app2 being exec for a sec but there is no output generated by app2.
Run it from the debugger and see if it's throwing an exception. You can also look in the event log to see if exceptions are showing up there.
Avatar of jgordin

ASKER

i ran it thru debugger but dont see any exceptions. how do i see event log?
If process1.start() doesn't do anything then either the application doesn't do anything or the process is not being loaded.

if you have the code to app2 then...
You can remotely connect to app2 using visual studio by selecting debug/Attach to process...
Make sure that you put a long wait at the start of app2 so that you can connect to it.
System.Threading.Thread.Sleep(10000);
Avatar of jgordin

ASKER

it seems that app1 starts app2 but app2 right the way.
Is app2 expecting command line parameters to be passed?
You can use process1.StartInfo.Arguments to do that.
Avatar of jgordin

ASKER

app2 doesnt expect any params to be passed.
You had mentioned that app2 produces output files. Are these files incomplete? Should app2 run longer? Is it possible for you to go through the code for app2?

if you can run app2 from the command line and from app1 and get the same results then app2 is at fault and needs to be fixed to do what you would like it to do.
Avatar of jgordin

ASKER

1. can run app2 using F5.
Avatar of jgordin

ASKER

i figured out my problem. it was app2 that was causing the proble.

i am getting a  pop up window while app2 is running. is it possible not to display that window.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial