简体   繁体   English

如何禁止以下命令在预构建事件上抛出错误?

[英]How do I suppress the following commands from throwing errors on a pre-build event?

I have tried piping the following two calls to NUL with no luck: 我已经尝试将以下两个调用传递给NUL而没有运气:

net stop "Logging Service">nul 2>&1
taskkill /IM LogServiceHost.exe /f >nul 2>&1

They will stop my build cycle from going through: 他们将阻止我的构建周期通过:

Error   1   The command "
net stop "Logging Service">nul 2>&1
taskkill /IM LogServiceHost.exe /f >nul 2>&1" exited with code 128. LoggingUtilities

Any ideas how I can just fire these prebuild events and not care what they return, and not have it ever suppress my build? 任何想法我怎么可以解雇这些预建事件而不关心他们返回什么,而不是让它压制我的构建?

Try adding the following line at the end of your post-build event. 尝试在构建后事件结束时添加以下行。 This should cause the automatically-generated .bat script to return an ERRORLEVEL 0. 这应该导致自动生成的.bat脚本返回ERRORLEVEL 0。

exit /b 0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Visual Studio 2013预构建事件从构建中排除脚本? - How do i use Visual Studio 2013 Pre-Build event to exclude a script from build? 如何判断应用程序是作为发布后/构建前事件还是独立运行? - How can I tell if an application is running as a post/pre-build event or standalone? 如何在预构建事件中更新.config项目值 - How to update .config item value in pre-build event 生成前事件命令行问题 - Pre-build event command line question 如果出现问题(VS 2010 / C#),我怎么能有一个预构建事件停止构建? - How can I have a pre-build event halt the build if something went wrong with it (VS 2010/C#)? 在VS 2017中添加预构建命令以将文件复制到项目 - Adding pre-build commands to copy files to a project in VS 2017 如何转换XML配置的预构建? - How to transform XML configuration pre-build? 预构建操作 - Pre-build action 如何以编程方式将AssemblyInfo.cs更新为预生成事件(Visual Studio / msbuild) - How to programatically update AssemblyInfo.cs as a Pre-Build event (Visual Studio / msbuild) 如何在预构建事件中将源文件(.cs)添加到资源(.resx)? - How to add source file (.cs) to resources (.resx) in a pre-build event?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM