Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. unable to run msbuild command from my c# console application code

unable to run msbuild command from my c# console application code

Scheduled Pinned Locked Moved Visual Basic
csharpvisual-studiocollaborationquestionworkspace
3 Posts 3 Posters 9 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Madhurima Dutta
    wrote on last edited by
    #1

    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?

    Richard DeemingR L 2 Replies Last reply
    0
    • M Madhurima Dutta

      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?

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      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

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      • M Madhurima Dutta

        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?

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups