Click here to Skip to main content
15,886,851 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Can we call following command programmatically ?


msbuild "MySolution.sln" /t:Build /p:Configuration=Debug /p:Platform="Any CPU"


or


ILDASM


Thanks
Posted

Thank you for your question. This a command. You can execute it in code.
Bellow link will help you.

http://www.codeproject.com/KB/cs/Execute_Command_in_CSharp.aspx[^]

Thanks,
Mamun
 
Share this answer
 
Comments
Khaniya 3-Dec-10 1:22am    
No this is not a answer
I need to call .Net command, not dos command
Hi Khaniya,

You can try following steps.

1. create a batch file with command.
2. Run batch file from code.

To Run batch file try this
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace VG
{
    class VGe
    {
        [STAThread]
        static void Main(string[] args)
        {
            Process proc = null;
            try
            {
                string targetDir = string.Format(@"D:\adapters\setup");//this is where mybatch.bat lies
                proc = new Process();
                proc.StartInfo.WorkingDirectory = targetDir;
                proc.StartInfo.FileName = "mybatch.bat";
                proc.StartInfo.Arguments = string.Format("10");//this is argument
                proc.StartInfo.CreateNoWindow = false;
                proc.Start();
                proc.WaitForExit();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception Occurred :{0},{1}", ex.Message,ex.StackTrace.ToString());
            }
        }
    }
}



,
 
Share this answer
 
Comments
Abdelrahman Othman Helal 14-Apr-18 10:27am    
Thank you! this worked for me like a charm after 5 hours of trials.
This[^] thread may also help.
 
Share this answer
 
System.Diagnostics .Process 

Helps you..,

Search in Google/CP for More information..,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900