RSS

Kill a process inside VisualStudio.net

01 Jan

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!

Advertisements
 
Leave a comment

Posted by on January 1, 2010 in Dotnet/C#

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: