Need help in MSBuild script for build pass\fail - msbuild

I have a question related to MSBuild script. My scenario is if build fails, build output should be copied into local system. If build passes, build output goes into a server destination folder.
Can anybody help me out? I am trying this with MSBuild not with Teambuilds.
Thanks
Shanthi

If your build fails then the output will be in an unknown indeterminable state that will be of little use to you, so there is little or no point in copying it to a local location. If the build fails then the final task which copies the output to the network won't be executed, so that problem is taken care of.
If you still want to handle errors and execute certain tasks upon failure, then this page has some good suggestions. Alternatively, you may find the need to write your own task to do specifically what you want (writing tasks is very easy), this link will help you with that.

Related

Is there a way to view Dart pub serve output in WebStorm in a more 'build-error-list' way?

I'm experimenting with Dart/Angular/WebStorm for the first time. One thing which I've found a little jarring has been the build->error cycle. In Visual Studio, I am used to this work flow:
Write some code
Running a build
Having a fresh list of errors being created
Fixing a subset of them (some or all)
Go to 1.
I'm wondering what is the workflow with Dart?
I have the following issues:
I can't figure out a way to just run pub/transformer/whatever-it-is-that-roughly-equates-to-a-build. The only way I can do this is by attempting to run a configuration
When the transformer is run, it just dumps a gigantic error output to the Pub Serve window. It does not clear the existing output, so I end up with duplicate error or errors I've already fixed. So I'm left manually scrolling through the list but taking care not to So I must manually right-click and clear the output window and rerun it.
The transformer only runs when it detects a file change. This makes sense, but when coupled with 1 and 2, I've often cleared the output and I am running the transformer just to see a fresh list of errors. Which I don't get.
So my workflow becomes:
Write some code.
Run
Close dartium browser window (I'm not actually interested in running it, just seeing my errors)
See a bunch of errors. Realise that I didn't clear the errors from the previous run.
Right click and clear the pub serve output window.
Run again
Close dartium browser window again
Realise that the transformer has not run because it already ran in steps 1-3 and I haven't changed a file.
Change a file
Run again
Close dartium browser window again
Scroll through error list to find errors to fix
I find this a little cumbersome. Perhaps there is a philosophical point here on relying too much on my tooling to identify and fix errors (although I thought that was the entire point) but I'm just wondering what other people do to simplify this - I'm faintly surprised I appear to be alone in this.
You may run 'Pub Build' (available in the right-click menu of pubspec.yaml file and also right in the editor when pubspec is open). It is not incremental, so it runs longer (i.e. runs from scratch each time) but it gives you the list of errors just as if you've cleared Pub Serve output, edited each file in the project, started run configuration and closed a browser.
Sometimes errors are only shown when pub serve generates output the first time. For reloads some errors aren't shown anymore.
I'm not sure if this is a limitation of pub serve or a bug in the transformers.
pub serve is going to be replaced a new build system that builds to disk instead of in-memory only.
DDC isn't perfect yet either, but it's the future and I'd suggest to try this instead. There are known performance problems with Angular, but they are working on it.
See also
- https://webdev.dartlang.org/tools/dartdevc
- https://github.com/dart-lang/build

How do I run just a single stage in my bamboo build?

I have a bamboo build with 2 stages: Build&Test and Publish. The way bamboo works, if Build&Test fails, Publish is not run. This is usually the way that I want things.
However, sometimes, Build&Test will fail, but I still want Publish to run. Typically, this is a manual process where even though there is a failing test, I want to push a button so that I can just run the Publish stage.
In the past, I had two separate plans, but I want to keep them together as one. Is this possible?
From the Atlassian help forum, here:
https://answers.atlassian.com/questions/52863/how-do-i-run-just-a-single-stage-of-a-build
Short answer: no. If you want to run a stage, all prior stages have to finish successfully, sorry.
What you could do is to use the Quarantine functionality, but that involves re-running the failed job (in yet-unreleased Bamboo 4.1, you may have to press "Show more" on the build result screen to see the re-run button).
Another thing that could be helpful in such situation (but not for OP) is disabling jobs.
Generally speaking, the best solution to most Bamboo problems is to rely on Bamboo as little as possible because you ultimately can't patch it.
In this case, I would just quickly write / re-use a aynchronous dependency resolution mechanism (something like GNU Make and its targets), and run that from a single stage.
Then just run everything on the default all-like target, and let users select the target on a custom run variable.

How to execute an application with test results after MSTest?

Anyway to have my project run a application after the test batch finished?
I was hoping to add a <Target> but was unable to find anything.
I am just wanting to pass the results to a seperate executable to parse into an html once my test is completed... perhaps a AfterTest target?
Anyone know a way to do this?
You are probably going to run trx2html ?
Then this applies to you: TestResults Reports in TFS Builds
In case of another executable, just follow the same instructions and replace trx2html by your alternative executable.

Is there a way to 'test run' an ant build?

Is there a way to run an ant build such that you get an output of what the build would do, but without actually doing it?
That is to say, it would list all of the commands that would be submitted to the system, output the expansion of all filesets, etc.
When I've searched 'ant' and 'test', I get overwhelming hits for running tests with ant. Any suggestions on actually testing ant build files?
It seems, that you are looking for a "dry run".
I googled it a bit and found no evidence that this is supoorted.
Heres a bugzilla-request for that feature, that explains things a bit:
https://issues.apache.org/bugzilla/show_bug.cgi?id=35464
This is impossible in theory and in practice. In theory, you cannot test a program meaningfully without actually running it (basically the halting problem).
In practice, since individual ant tasks very often depend on each other's output, this would be quite pointless for the vast majority of Ant scripts. Most of them compile some source code and build JARs from the class files - but what would the fileset for the JAR contain if the compiler didn't actually run?
The proper way to test an Ant script is to run it regularly, but on a test system, possibly a VM image that you can restory to the original state easily.
Here's a problem: You have target #1 that builds a bunch of stuff, then target #2 that copies it.
You run your Ant script in test mode, it pretends to do target #1. Now it comes to target #2 and there's nothing to copy. What should target #2 return? Things can get even more confusing when you have if and unless clauses in your ant targets.
I know that Make has a command line parameter that tells it to run without doing a build, but I never found it all that useful. Maybe that's why Ant doesn't have one.
Ant does have a -k parameter to tell it to keep going if something failed. You might find that useful.
As Michael already said, that's what Test Systems - VM's come in handy- are for
From my ant bookmarks => some years ago some tool called "Virtual Ant" has been announced, i never tried it. So don't regard it as a tip but as something someone heard of
From what the site says =
"With Virtual Ant you no longer have to get your hands dirty with XML to create or edit Ant build scripts. Work in a completely virtualized environment similar to Windows Explorer and run your tasks on a Virtual File System to see what they do, in real time, without affecting your real file system*. The actual Ant build script is generated in the background."
Hm, sounds to good to be true ;-)
..without affecting your real file system.. might be what you asked for !?
They provide a 30day trial license so you won't lose no money but only the time to have a look on..

Visual Studio 2008 - Start debugging?

Using VB 2008
When I press the F5 or Start Debugging it does a rebuild even when I have made no changes since the last time. Where is the setting to tell it to only do a rebuild if there are changes?
F5 should a build and not rebuild, are you sure it's a rebuild? Even you do not make any changes, a 'pseudo' build is still executed, and should be significant faster than a normal build or rebuild.
EDIT:
My definition of a 'pseudo' build is to check for need to build and/or making sure all files required for debugging are present (e.g. pdb files)
In my installation, F5 (Start Debugging) only builds when changes have been made. This includes changes that don't actually effect the code (like modifying comments). If I do F5, close the program, and push F5 again (without changing anything), no rebuild takes place. Is there something I'm missing?
As other have mentioned, Visual Studio only rebuilds what it thinks needs rebuilding.
My advice is to check what it actually builds, to see what made the build system think it was out-of-date. I've often seen this issue when, e.g., a custom build step was used, and the output of the step was specificed incorrectly. So VS is expecting a built file (because you told it it would be there), and since the built file is not there, it restarts that specific build step, along with all the projects that depend on the project containing the build step.
This is just one example. It usually boils down to an expected generated file that gets moved or is missing.
If this does not help, maybe a build log would help identifying your issue in more depth.