I'm wondering if it's possible to tell Visual Studio to print the output of an external build tool as it gets it.
I have an external build tool (JSIL) called from my .csproj file like so:
...
<Target Name="AfterBuild" Condition="$(JSIL) != 'building'">
<Exec Command="JSILc.exe $(SolutionPath)" />
</Target>
...
This works fine--the output goes to the Visual Studio output window. However, it seems that Visual Studio buffers the output of the command until it exits and then prints that output in its entirety all at once.
Since the JSIL compiler takes a relatively long time and has quite a bit of output, I would like for the output window to reflect that while building.
JSIL outputs commands by printing to stdout or stderr, but manually .Flush()ing these streams doesn't seem to affect the output window. Is there some special API that I need to call to update Visual Studio about the progress of a custom build tool?
Thanks!
Related
My build process involves an Exec task that runs a console program.
<Target Name="TestTask" AfterTargets="AfterBuild">
<Exec Command='program.exe" />
</Target>
The program's output is shown in the "output" window, but only after the task has finished (all at once). How can I see the output gradually? It's a long-running task that reports a lot of thing as it goes...
UPD: found a relevant question with a workaround: MSBuild AfterBuild messages not showing real-time
Visual Studio MSBuild exec task - output window buffer flush
I`d like provide your a workaround for this issue, but I am not sure if it exactly meets your requirements.
To accomplish this, you could try putting the execute command in a batch file and invoking the batch file instead. Not very elegant but might do the trick. The batch file like:
start /d "<PathForTheProgram.exe>" program.exe
Or you can use Windows power-shell to start the program.exe directly:
<Target Name="TestTask" AfterTargets="AfterBuild" >
<Exec Command="powershell start-process "<PathForEXE>\program.exe "" />
</Target>
The different is that the program's output is shown in the command prompt window not inside in the Visual Studio output window.
Hope this helps.
I am using visual studio to develop a command line program which takes certain parameters from the command line arguments and its input from the stdin. Currently I am debugging it by setting the parameters manually in project properties as seen in the screenshot:
However I am using a script to generate and compare input, parameters and outputs and I would like to debug the errors, once I have found the appropriate inputs/params/outputs with my script, inside visual studio. Currently I have to manually copy the parameters, I would like to have them read from param.txt which is in the same directory as input.txt which works as an input.
I have a project, which use a .rules file to build some non-c++ sources. How to make MSBuild print diagnostic output from this tool? -- Precisely cerr stream.
(I silently presume, the M$ team have not reached that level of insanity, to give the custom building tools functionality without possibility to print errors from them.)
I've actually noticed you marked question with label visual-studio-2008. I guess it means your custom build tool processes non cpp files in vc2008 project? If so, I think it is not built by msbuild but with vcbuild.
In this case try to add echo on in front of command executed by custom tool.
Vcbuild creates batch files in %temp% that first line contains #echo off and then it is executed. So if you add echo on you should see complete output in output window including command line used for command execution.
When I run cucumber from the windows command line I get colored output (currently using ANSICON).
When I use the following MSBuild target, run from the command line, I don't get colored output
<Target Name="Tests_Functional_Run">
<Exec Command="bundle exec cucumber" />
</Target>
Any ideas how I can get colored output in MSBuild?
First of all, I just had to read this question to see what "Colored Cucumber" was...
Are you building the project in Visual Studio, or using MSBuild from a command line? I ask because MSBuild from a command line puts out all sorts of coloured output, but I've never seen colour in the VS output window.
The coloration is an artifact of the "display module" (for lack of a better term at hand). The Windows console is sensitive to the type of message it displays from command-line output.
You'd need to make or find a VS add-in to colorize the Output pane. Or copy the text into a capable editor and use its colorizing capabilities.
Your terminal needs to support ANSI color. We use something called ANSICon here, it can be set up so it installs itself in all cmd shells and gives color output for cucumber.
I'm using Visual Studio 2005 Express Edition with SP1.
I have a Pre-Link Event which needs to invoke one program and send its output to another.
foo | bar
This command works as expected when invoked from a command line or batch file. The command fails when invoked from the Pre-Link Event (even if the Pre-Link Event invokes a separate batch file containing the command). 'foo' runs and produces output which appears in Visual Studio, but this output is not fed to 'bar', and in fact it appears 'bar' is never invoked at all. Even when the Pre-Link Event invokes CMD or NMAKE which in turn invokes the piped commands, only 'foo' runs.
Is Visual Studio broken and/or is there some arcane ritual I can perform to make this work?
This was answered here for the > operator. I suspect the same thing may be happening with pipes.