开发者

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?


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


I face the identical problem with an old project (VS2005 in Win7-32). The build step with copy fails, as the target is set of any reason to read-only and hidden. Replacing copy with xcopy and some parameters helped me

Example:

Failing: copy /Y C:\Dev\Projx\mydll.dll C:\Test\Projx\

Working: xcopy /Y /H /R C:\Dev\Projx\mydll.dll C:\Test\Projx\

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜