By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,827 Members | 2,155 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,827 IT Pros & Developers. It's quick & easy.

I want to compile and run our simple c# from our winform

P: 1
We compile our program from process.start that compiled but after compilation don't create an exe file

if thats programe compile from cmd then exe file is generate
Expand|Select|Wrap|Line Numbers
  1. Process ps = new Process();
  2.                 ps.StartInfo.FileName = "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc.exe";
  3.                 ps.StartInfo.Arguments = "D:\program.cs"
  4.                 ps.StartInfo.UseShellExecute = false;
  5.                 ps.StartInfo.RedirectStandardOutput = true;
  6.                 ps.Start();
  7.                 ps.WaitForExit();
  8.                 Result_txt.Text = ps.StandardOutput.ReadToEnd();
  9.  
  10.  
  11.  
  12. string exe_file = fi.FullName.Remove((fi.FullName.Length - 3), 3) + ".exe";
  13.                 if (File.Exists(exe_file))
  14.                 {
  15.                     ps = new Process();
  16.                     ps.StartInfo.FileName = exe_file;
  17.                     ps.StartInfo.UseShellExecute = false;
  18.                     ps.StartInfo.RedirectStandardOutput = true;
  19.                     ps.StartInfo.RedirectStandardInput = true;
  20.                     ps.Start();
  21.                     Result_txt.Text += ps.StandardOutput.ReadToEnd();
  22.                     ps.WaitForExit();
  23.                 }
  24.  
Jul 16 '19 #1
Share this Question
Share on Google+
1 Reply


P: 9
in Russia compile using bat:

inside folder
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
attention: Framework ... 64

bat for windows c#:

Expand|Select|Wrap|Line Numbers
  1. csc.exe /target:winexe program.cs
  2. pause
bat for dos c#:

Expand|Select|Wrap|Line Numbers
  1. csc.exe /nologo program.cs
  2. pause
I hope it helps to shape your start
2 Days Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.