Post build event write to VS output console - visual-studio-2010

Is it possible somehow write to VS output console from post build event script? Something like:
#echo $(ProjectDir)

Yes this will work fine.
I had the same question and found that echo works fine to write to output in the VS build events.

Related

teamcity how to see the final output of command line build step custom script

Given a Command line build step, with the following custom script:
msdeploy -verb:sync -source:package='%teamcity.build.projectid%\%WebProjectName%.csproj.zip'
how can i see what the variables ended up being replaced with?
I don't see any "verbose logging" option that holds the final output for debugging the build server anywhere
There's Parameters tab (accessible like http://teamcity/viewLog.html?buildId=BUILD_ID&tab=buildParameters where BUILD_ID should be replaced with id of the given build) in Build overview.
There're parameters values as they were resolved when build started.
This page is also accessible via popup displayed at the end of a build status text in build results row in Build Configuration Overview or Project view.
There is a file in [tempdirectory]\agentTmp called build.start.properties.gz open with something like winrar or 7zip and there is a file called build.start.properties.
In there you will be able to see the parameters used for the build like %teamcity.build.projectid%
In case anyone else comes here, the reson you are probably looking for that file is that your script isnt working, I would suggest you change
-source:package='%teamcity.build.projectid%\%WebProjectName%.csproj.zip'
"%WebProjectName%"
and include double quotes around your variables, if WebProjectName contains spaces your script might not work.
If your custom script is running in Unix-like environment you can use shell command set -x to print each command before execution
Full explanation here https://stackoverflow.com/a/2853811/2584381
If you are running on Windows, your command step has an implicit #echo off at the start.
To get full info in the logs, add
echo on
to the top of your command script.

Schedule .bat isn't executing VBScript properly

So I've got 2 things going on: a program that checks the status of some folders, then a VBScript that runs afterwards to email recipients of any errors going on in said folders. Even if there is none, it's supposed to send a "No Errors" email.
Both of them work perfectly fine individually. The checker .exe program runs with no issues, and when I run the VBScript by itself, it sends all the emails it's supposed to. However, I put the following into a .bat file to run nightly at 11pm:
"C:\batch\night_monitor\checker.exe"
"C:\batch\night_monitor\emailer.vbs"
For some reason, when the batch file is run, only 1 out of 5 emails go out. By default, all the flags are set to true, and when I look in the log file, I see that the emailer.vbs is only checking 2 error logs instead of 5. Like I said though, the emailer works perfectly fine if I just run it by itself. Is there something major that I'm missing here?
Try this..
#ECHO OFF
START "Checker" /WAIT "C:\batch\night_monitor\checker.exe"
START "Emailer" /WAIT "C:\batch\night_monitor\emailer.vbs"
Run START /? from a command line to see all the options.
It seems your checker.exe isn't finished when emailer.vbs is started.
Try running your programms in sequence:
"C:\batch\night_monitor\checker.exe" & "C:\batch\night_monitor\emailer.vbs"
... or execute emailer.vbs only if checker.exe executed successfuly:
"C:\batch\night_monitor\checker.exe" && "C:\batch\night_monitor\emailer.vbs"
Another alternative would be to call checker.exe from inside emailer.vbs to make sure it has finished before you access the error logs.

Visual Studio and console window to see Echo from batch file

I'm getting familiar with VS2008. I made a batch file, with some Echo statements.
I have the batch file running after a successful build.
Is there a console window that I may see the echo outputs?
If I'm understanding you correctly, look at the Output window.
To get the output window, Go to View -> Output or Ctrl+W, O
To display the Output window, select Output from the View menu.

vs.net multi pre-build commands

Hi all I have an external project and I want to build it in the main project for that
I'm using pre-build commands.I want to use multi commands for copying aspx pages and
ascx usercontrols to sercontrol folder.
When I use one command it works but when I write both lines it returns error code 1
and not builds.I tried to put comma between two commands but not worked.
copy $(SolutionDir)\WebUI.PlugIn.UrlUsage\*.aspx $(ProjectDir)\Pages\Report
copy $(SolutionDir)\WebUI.PlugIn.UrlUsage\*.ascx $(ProjectDir)\UserControls\Report
Can you say how to run mlti commands in pre-build events of vs.net?
A good technique is look at the error produced by Visual Studio when the prebuild fails. Copy that error to the command line and run it. That should allow you to see what the issue is more clearly.
In this case it might be something simple like not having quotes round stuff.
It shouldn't make a difference but you don't need the first \ after the $(SolutionDir).

Why doesn't cl.exe generate any output when I call it from Perl?

I'm having a weird problem with running cl.exe that has me stumped. In a large VS2008 solution consisting of C/C++ projects, I have one project that runs some scripts to do some extra processing. The project consists of a pre-build event, which calls a Perl script (ActiveState Perl is on the machine). This Perl script then calls cl.exe with /E to generate preprocessed output which gets redirected to a file. The line in Perl looks like this:
my $foo = `"\path\to\cl.exe" #args.rsp >out.txt 2>err.txt`;
args.rsp is a plain text file that contains a bunch of command line args for cl.exe, including /E to get pre-processor output on stdout.
This exact command line works as expected when run from the VS2008 command prompt. Building the project also works fine on my Windows XP machine. However, on my new Windows 7 box, when I build the project, out.txt ends up blank. I should also add that on some of my coworker's Windows 7 boxes, it works fine, and on some others it doesn't.
Clearly there's some kind of configuration difference going on, but I'm at a loss as to what it may be. We've checked matching versions of VS2008 SP1 and ActiveState Perl. I've tried myriad workarounds within the perl script - using system() instead of backticks, using cl.exe /P to output to a file and then moving the file (the file is blank), unsetting the VS_UNICODE_OUTPUT environment variable (no effect). Nothing has changed the behavior - output is generated when the command line is run manually, but not when it's run inside the pre-build event for this project.
Any ideas on what kind of configuration problem may be causing this? I'm pretty much out of avenues to pursue.
Sounds like an ACL issue to me. You can change windows to log access issues and then check the event log to see what user is getting access denied errors.
I believe the setting is in Local Policy | Audit Policy | Audit Object Access
Wow, the solution to this ended up being a lot stranger than I expected. The machine I'm working on (and the other co-workers who are also experiencing the problem) is a Mac Pro with bootcamp and Windows 7 installed. That causes C: to have the windows drive and E: to have the mac drive. This causes a problem because the pre-build event has a couple lines that test each drive letter to see if there's a drive there, and if there is, adds X:\Perl\bin to the path. Even though E:\Perl\bin doesn't exist, it gets added to the path. Later, the perl script runs and then calls cl.exe, and for some reason, having a directory in the mac drive causes cl.exe to fail. Why? I have no idea. Anyway, removing the mac drive directory from the path fixes the problem!
Thanks for your eyes everyone.
Check out the exit code of your program. You may want to build your executable name in a portable way using something like File::Spec. Also, check that #args is not interpolating. You may want to print your command line before executing to check if that's what you want. What is left your err.txt file?

Resources