Reputation: 21729
I have an integration test for a method in assembly A
. Assembly A
references assembly B
via project reference. I run them under the Visual Studio 2010 debugger in a Resharper 6.1 unit testing scenario. The testing engine is Microsoft's native MSTest.
I get the infamous
The process cannot access the file
...\B.dll
because it is being used by another process.
message. I have verified that no other process has a handle on that file (e.g. via Sysinternal's Process Explorer).
Running the test out of the debugger works fine. Any ideas why it happens under the debugger and what I can do to fix it?
Upvotes: 5
Views: 1909
Reputation: 5526
Building upon @mrtumnus' answer and the answer here, I added a pre-build step to my test project to automatically kill any vstest.*
executables:
START taskkill /f /im vstest.*
Using START
instead of exit 0
so it doesn't give an error if the task isn't running. (It does open a command window, though, which is a bit annoying).
Upvotes: 1
Reputation: 399
Building upon Sébastien's answer, I added a pre-build step to my test project to automatically kill any vstest.*
executables still running. The following pre-build command worked for me:
taskkill /f /im vstest.*
exit 0
The exit 0
command is at the end to prevent build failure when there are no vstest.*
executables running.
Upvotes: 8
Reputation: 96
I have seen a similar situation, and found in the task manager that vtest.discoveryengine.exe and vtest.executionengine.exe were still alive. I killed both, which solved the problem.
Upvotes: 7