Quantcast
Channel: Dotnet/C# – Xinyustudio
Viewing all articles
Browse latest Browse all 204

Kill a process inside VisualStudio.net

$
0
0

In developing some addin projects, the output assembly is hosed by another process, and sometimes, after code editing, you wish to recomplile the code and run it again. Unfortunately, you are not always lucky enough.

You may see such errors like below shown:

Error    64    Unable to copy file "xxxAddin.dll" to "xxxAddin.dll". The process cannot access the file ‘xxxAddin.dll’ because it is being used by another process.  

You can then turn to Task Manager, find the process, and then kill it, and then recompile in Visual Studio.

An easy way is to automate this is to use “External Tools” in Visual Studio:

KillProcess_A

The one labelled with A are the build-in external tools facilitated with VS. and the one with B is developed by ourselves. We can also put this custom tools inside a toolbar.

In VS, Tools>Customize, drag the external tools “N” to an existing toolbar.

KillProcess_B 

KillProcess_C

You can customize the icon image as well by right clicking the toolbar item.

KillProcess_D

Now, let us finally program a console application:

KillProcess_E

Enjoy!


Posted in Dotnet/C#

Viewing all articles
Browse latest Browse all 204

Trending Articles