0

I have two projects, one is simple console app project and another is test project. And inside of mine console app I'm having functionality to check if tests from test project (based on build id) passes or fails.

I want to execute that console app each time when build is done so I can get status of these tests and do additional stuff with results.

Is that something which can be done with some kind of post-build script on TFS?

1
  • Have you tried Tingting's solution, is that resolve your issue? Commented Aug 24, 2017 at 10:06

2 Answers 2

1

It seems that you're using XAML build. If you use XMAL build, there's no environment parameters for BuildId. All the environment variables for XAmL build are listed here: https://msdn.microsoft.com/library/hh850448%28v=vs.120%29.aspx.

As a workaround, you could use TF_BUILD_BUILDURI variable. As you can see, at the end of the buildUrl is the buildId. You could extract the buildID through the buildURL.

Sign up to request clarification or add additional context in comments.

Comments

0

Configure the TFS Template to specify post build script. Refer to this Microsoft Article

6 Comments

Is it posible to pass build id as parameter?
Yes, it is available by default in the environment by the name of Build.BuildId or Build_BuildId. Refer here
Hm, I tried in my bat file to use it as myProgram.exe %BUILD_BUILDID% but it's empty parameter passed to my exe. Any idea why?
@ShP How did you pass the variable value to .exe ? According to the documents, the format %BUILD_BUILDID% can be only available in Batch script. If you want to pass the value to .exe file, you can try to set the "Command Line Arguments" first, then pass the arguments in command line in your bat script file. Reference this thread:social.msdn.microsoft.com/Forums/vstudio/en-US/…
I am aware that I need to set command line arguments, but the thing is that in batch file which looks like this myProgram.exe %BUILD_BUILDID% which is triggered as post build event script, nothing is passed to my exe as command line argument.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.