PDA

View Full Version : Deployment Project Failure Does not Fail Build?


scott willeke
03-08-2004, 11:19 AM
I have noticed that when building Visual Studio .NET Solutions containing only “Deployment Projects” if one project fails to build the build step does not fail, and Visual Build reports the build succeeds. Apparently VS.NET still returns 0 as the success code when deployment projects fail?
The log file shows this at the end of the solution build for the step:
---------------------- Done ----------------------
Build: 3 succeeded, 1 failed, 0 skipped

I verified that the “Ignore Fail” checkbox for the step is not checked.

Additionally, in a subsequent step I have a “Copy Files” step that copies the resulting .msi file to another folder. Despite the fact that the source file does not exist and the step does not copy any files (“0 file(s) copied” is recorded in the log), this step does not fail either.

I need the build to fail if either of these steps does not succeed. I thought of adding an additional step using script to check for the existence of the file (something like (if not vbld_FSO.FileExists("mysetup.msi") then Err.Raise…), but I wanted to see if there was a better solution or recommendation first.

Any suggestions on how I can make one or both of these steps cause the build fail?

kinook
03-08-2004, 03:32 PM
It appears that VS.NET does not always return a failure exitcode when some project types fail to build. What you could do is add a check in the step's vbld_StepDone script event (click Script Editor from the step properties dialog and go to the Step tab) that fails the build based on the step output. Here's a VBScript version

Function vbld_StepDone()

If InStr(vbld_AllMacros()("LASTSTEP_OUTPUT").Value, " 0 failed") = 0 Then _
Err.Raise 1, Step.Name, "One or more projects failed to build"

End Function


It's not an error condition for the Copy Files action to not copy any files -- the values specified for include/exclude are evaluated as masks which can match zero or more files, and incremental copy may result in no files getting copied even if some match the masks. You could use a Run Program action with a regular %DOSCMD% copy "source" "dest", which will fail if the copy does not succeed.

pjaquiery
03-08-2004, 03:38 PM
It may be nice in a future version to set a system macro to the number of files copied by the Copy Files step.

kinook
03-08-2004, 04:13 PM
Good idea. For now, you could also do a similar check in the Copy Files action's StepDone event.

scott willeke
03-10-2004, 03:58 PM
I've started to use the script to check build output for now. Thanks very much for the help.