visual-studio-2005custom-build-step

Possible to ignore vs2005 custom build step failure?


I have a visual studio 2005 project with a custom build step that copies a library file to the target applications plugin directory. This works fine, but in the case where I have the target application open it fails, understandably.

The problem with this behaviour is it prevents my build from continuing, meaning I can't hit build, then grab a coffee, and expect the build to be complete when I get back.

My question is, can I set-up the project so that if the custom build step fails, the build will continue?


Solution

  • The solution to this problem was to handle the failure in the post build event. The following code fixes the issue:

    copy $(TargetPath) "%programfiles%\mypath"
    if errorlevel 1 goto BuildProcessFailed
    
    goto BuildProcessOK
    :BuildProcessFailed
    echo BUILDPROCESS FAILED FOR PROJECT $(ProjectName)
    goto ExitBuildProcess
    :BuildProcessOK
    echo BUILDPROCESS OK FOR PROJECT $(ProjectName)
    
    :ExitBuildProcess