解决"命令" TASKKILL / F / IM MyApp.vshost.exe"与code 128 QUOT退出;错误 [英] Solve "The command "taskkill /F /IM MyApp.vshost.exe" exited with code 128" error

查看:382
本文介绍了解决"命令" TASKKILL / F / IM MyApp.vshost.exe"与code 128 QUOT退出;错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上下文结果
当调试(使用的调试的菜单<大骨节病> F5 )Visual Studio解决方案,这个过程被称为 MyApp.vshost.exe 是创建。当你停止调试的猥亵的 - 我的意思是使用的停止调试的菜单<大骨节病> SHIFT + <大骨节病> F5 ,而不是等待发生像 Application.Exit code线() - 这个过程是不杀

有时,当你以后再次启动调试应用程序,出现错误信息,称该文件(很明显,它是由调试使用的文件:斌\\调试\\ MyApp.vshost.exe )已在使用。

这就是为什么我添加到构建事件,此命令行: TASKKILL / F / IM MyApp.vshost.exe

问题结果
MyApp.vshost.exe 进程不存在,Visual Studio是有时在编译的时候抛出一个错误,从而$ ​​P $ pventing构建应用程序:

 错误C:\\ WINDOWS \\ Microsoft.NET \\框架\\ v4.0.30319 \\ Microsoft.Common.targets
命令的taskkill / F / IM MyApp.vshost.exe退出,code 128。

唯一的现有的解​​决方案,我发现是删除生成的事件。

结果
有没有解决该错误消息而不删除生成事件的方式?

修改

我想最好的解决办法是检索命令的返回code(错误级别),则返回0,如果它等于128。是否有可能做到这一点在项目生成事件?


解决方案

  TASKKILL / F / IM MyApp.vshost.exe 2  - ;&放大器; 1 ||出口/ B 0

Context
When debugging (with the Debug menu F5) a Visual Studio solution, a process called MyApp.vshost.exe is created. When you stop the debug indecently - I mean using the Stop Debug menu SHIFT+F5 and not waiting for a code line like Application.Exit() occurs - this process is not killed.

Sometimes, when you later start again debugging your application, an error message occurs, saying that the file (obviously, it is the file used by the debug: bin\Debug\MyApp.vshost.exe) is already in use.

That is why I added to the Build events this command line: taskkill /F /IM MyApp.vshost.exe

Problem
When the MyApp.vshost.exeprocess does not exist, Visual Studio is sometimes throwing an error at build time, thus preventing to build the application:

Error c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets
The command "taskkill /F /IM MyApp.vshost.exe" exited with code 128.

The only existing solution i found is to remove the build event.

Question
Is there a way to resolve the error message without removing the build event?

EDIT

I'm thinking the best solution would be to retrieve the return code (errorlevel) of the command, then return 0 if it is equal to 128. Is it possible to do it in the Build events of the project?

解决方案

taskkill /F /IM MyApp.vshost.exe 2>&1 || exit /B 0

这篇关于解决&QUOT;命令&QUOT; TASKKILL / F / IM MyApp.vshost.exe&QUOT;与code 128 QUOT退出;错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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