在 Visual Studio 2010 中的预构建步骤中吞咽错误 [英] Swallowing errors in pre-build steps in Visual Studio 2010

查看:26
本文介绍了在 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天全站免登陆