PDA

View Full Version : Build failed, wasn't caught


sodablue
10-28-2004, 08:43 AM
I had a ASP.NET web project fail to build because the IIS service was shut down, and VS.NET couldn't connect the project to the virtual directory. This was with VS.NET 2002, and it didn't report an error instead just spitting out this message and exiting:

Unable to open Web project 'Host'. Unable to validate that the file path 'D:\src\Host' matches the URL path 'http://localhost/Host'. A connection with the server could not be established


I had checked on the option to parse build output, but apparently Visual Build(v5.5) doesn't look for this particular error.

I found a workaround, which was to put something in the StepDone event to check for this and throw an error if the step failed.

Function vbld_StepDone()

dim macros, macro, LastOutput
set macros =Application.Macros(vbldMacroAll )
set macro = macros.Item("LASTSTEP_OUTPUT")
LastOutput = macro.Value

If instr(1, LastOutput, "Unable to open Web project", 1) > 0 then
builder.LogMessage("Unable to open Web project")
Err.Raise 1, "", "Step failed"
end if

End Function

I thought I'd pass that tip along to others.

kinook
10-29-2004, 06:06 AM
Since version 5.3 (http://www.kinook.com/Forum/showthread.php?threadid=375) this is provided via the 'Parse build output...' checkbox. From the Make VS.NET action help topic:

Parse build output for failed projects: Sometimes, devenv.com will return a success (0) exitcode even if one or more projects failed to build. If this box is checked, the action also parses the build output to verify that 0 projects failed to build, and if an error condition is found, the step will also be marked as failed.

But that is the right approach to do it yourself (the Make VS.NET action's check is a little more generic but should work in this case too).