在Visual Studio 2010的预生成步骤中吞下错误 [英] Swallowing errors in pre-build steps in Visual Studio 2010

查看:100
本文介绍了在Visual Studio 2010的预生成步骤中吞下错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的解决方案有很多项目,其中一个是Windows服务.我有一个预构建步骤来停止该服务,并有一个后构建步骤来重新启动该服务(这样,当VS构建/覆盖它时,Windows服务exe不会被锁定).

My solution has a bunch of projects one of which is a windows service; I have a prebuild step to stop the service and a postbuild step to restart it (this way the windows service exe is not locked when VS is building/overwriting it).

on pre-build: 
net stop myservice

on post-build:
net start myservice

如果在启动构建过程中该服务未运行,则net stop命令将失败,这将阻止进行构建.

If the service is not running while I'm starting the build, the net stop command fails and that prevents the build from proceeding.

即使预构建步骤失败了,我该怎么办仍要强制构建?

What can I do to still force the build even if the pre-build step failed?

推荐答案

我知道了-您只需要在末尾添加以下语句即可:

I figured it out - you simply need to add the following statement at the end:

SET ERRORLEVEL = 0

或简单地:

EXIT 0

这篇关于在Visual Studio 2010的预生成步骤中吞下错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆