unable to run msbuild command from my c# console application code
-
i have been using cliwrap for running git commands and passing the arguments. But it seems to have failed while running my msbuild command from my c# console application. What i am trying- var stdOutSetup = new StringBuilder(); var stdErrSetup = new StringBuilder(); var Setup = await Cli.Wrap("msbuild") .WithArguments("/t:scmclean && /t:setup") .WithStandardOutputPipe(PipeTarget.ToStringBuilder(stdOutSetup)) .WithStandardErrorPipe(PipeTarget.ToStringBuilder(stdErrSetup)) .ExecuteBufferedAsync(); var stdOut2 = stdOutSetup.ToString(); var stdErr2 = stdErrSetup.ToString(); Console.WriteLine("Build Commands Output :"); Console.WriteLine(stdOut2); Console.WriteLine(stdErr2); is there any possible way where i can run msbuild commands from my c# console application?
-
i have been using cliwrap for running git commands and passing the arguments. But it seems to have failed while running my msbuild command from my c# console application. What i am trying- var stdOutSetup = new StringBuilder(); var stdErrSetup = new StringBuilder(); var Setup = await Cli.Wrap("msbuild") .WithArguments("/t:scmclean && /t:setup") .WithStandardOutputPipe(PipeTarget.ToStringBuilder(stdOutSetup)) .WithStandardErrorPipe(PipeTarget.ToStringBuilder(stdErrSetup)) .ExecuteBufferedAsync(); var stdOut2 = stdOutSetup.ToString(); var stdErr2 = stdErrSetup.ToString(); Console.WriteLine("Build Commands Output :"); Console.WriteLine(stdOut2); Console.WriteLine(stdErr2); is there any possible way where i can run msbuild commands from my c# console application?
You have already posted this in the C# forum: Running MSBuild Commands from My C# console application. - C# Discussion Boards[^] And again in QA: How do I run msbuild commandline arguments from my C# console application[^] And even if you hadn't, a C# question does not belong in the Visual Basic forum!
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
i have been using cliwrap for running git commands and passing the arguments. But it seems to have failed while running my msbuild command from my c# console application. What i am trying- var stdOutSetup = new StringBuilder(); var stdErrSetup = new StringBuilder(); var Setup = await Cli.Wrap("msbuild") .WithArguments("/t:scmclean && /t:setup") .WithStandardOutputPipe(PipeTarget.ToStringBuilder(stdOutSetup)) .WithStandardErrorPipe(PipeTarget.ToStringBuilder(stdErrSetup)) .ExecuteBufferedAsync(); var stdOut2 = stdOutSetup.ToString(); var stdErr2 = stdErrSetup.ToString(); Console.WriteLine("Build Commands Output :"); Console.WriteLine(stdOut2); Console.WriteLine(stdErr2); is there any possible way where i can run msbuild commands from my c# console application?
Madhurima Dutta wrote:
is there any possible way where i can run msbuild commands from my c# console application?
Yes, and the effect will be similar to writing them commands in a batch file. Why is there an "await" in your code? Search for C# execute console commands, the web has enough examples on how to launch stuff on the console.
Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.