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.
thanks.
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
Jim
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
Jim
ASKER
i am trying to call *.exe file (c# app1) from c# app2.
ASKER
i asked the same question in:
https://www.experts-exchange.com/questions/22752887/c-how-to-execute-an-executable-from-c-appliaction-and-log-erros.html
https://www.experts-exchange.com/questions/22752887/c-how-to-execute-an-executable-from-c-appliaction-and-log-erros.html
What does your invocation code (code to launch the other exe) look like?
ASKER
string executable = "A:\\Projects\\bin\\Releas e\\ABC.exe ";
Process process1 = new Process();
process1.StartInfo.UseShel lExecute = false;
process1.StartInfo.CreateN oWindow = false;
process1.StartInfo.WindowS tyle = ProcessWindowStyle.Hidden;
process1.StartInfo.FileNam e = executable;
process1.Start();
process1.WaitForExit();
int exitCode = process1.ExitCode;
Process process1 = new Process();
process1.StartInfo.UseShel
process1.StartInfo.CreateN
process1.StartInfo.WindowS
process1.StartInfo.FileNam
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.
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.Redirec tStandardO utput = true;
process1.StartInfo.Redirec tStandardE rror = true;
To read them use
process1.StandardOutput.Re adLine();
process1.StandardError.Rea dLine();
Use the following code to do that:
process1.StartInfo.Redirec
process1.StartInfo.Redirec
To read them use
process1.StandardOutput.Re
process1.StandardError.Rea
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.
Do you know what app1 is supposed to do? Maybe it writes its data to file or other location.
ASKER
files in release directory:
Type
1. ProjectName 50KB Application
2. ProjectName 75KB Program Deb
3. ProjectName.exe 2KB XML
Type
1. ProjectName 50KB Application
2. ProjectName 75KB Program Deb
3. ProjectName.exe 2KB XML
ASKER
app1 just has to execute app2. i stepped thru it . process1.Start() doesnt do anything.
ASKER
app2 writes data into output directory.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i set:
process1.StartInfo.UseShel lExecute = true;
process1.StartInfo.CreateN oWindow = true;
i can see that app2 being exec for a sec but there is no output generated by app2.
process1.StartInfo.UseShel
process1.StartInfo.CreateN
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.
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.Sl eep(10000) ;
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.Sl
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.Argumen ts to do that.
You can use process1.StartInfo.Argumen
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.
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.
ASKER
1. can run app2 using F5.
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.
i am getting a pop up window while app2 is running. is it possible not to display that window.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Jim