Freigeben über


The process cannot access the file because it is being used by another process.

Ever seen the error in the title...the one that happens when you rebuild your project in VS and it says:

Error 1 Could not write to output file Foo.exe' -- 'The process cannot access the file because it is being used by another process. '

This is a very frustrating error that many users have complained to us about in VS 2003. We have spent many hours figuring out these problems and fixing them. In Whidbey, we want to fix any bugs like these - we've fixed known issues from VS 2003, but if you happen to see one of these in Beta2, here's a guide of things to do. Please report the following stuff to us in the bug you open at the Product feedback site:

  1. Are any Visual Designers open? Does closing Visual Designers (and restarting devenv) help?
  2. Install Process Explorer from

www.sysinternals.com. Search for handles open on the output file (Foo.exe/Foo.dll) . Who is holding handles on it?

Is the Object Browser open? Does closing it help? Does closing it and restarting devenv help?

Provide an inventory of all windows (including tool windows) open. Sometimes one of these windows has a component loaded locking the dll.

If you can, please send the solution that repros the problem (if you have a consistent repro).

Are any addins running when this error occurs? Perhaps disabling addins helps?

Hopefully, going through these steps should also help you find a workaround for this annoying issue. Please report it to us if you do see it - we want to fix all of these.

Shaykat

Comments

  • Anonymous
    May 05, 2005
    Actually, closing object browser won't unload the DLL (if it was indeeded loading into object browser). You need to remove the library from object browser. Once done, you don't even need to restart VS.
  • Anonymous
    May 06, 2005
    I have to close & reopen the solution for the files to get 'unlocked' , sometimes the files are locked just by opening the solution, and almost never happens on the final dll (web app), only on dependencies. Also some of the .xml files (documentation) get locked too and that messes with intellisense.
  • Anonymous
    May 06, 2005
    Pablo, does this happen with Beta2?
  • Anonymous
    May 06, 2005
    ops.. sorry, that was 2003,
    I've only tested beta1 (very little) so far...
  • Anonymous
    May 06, 2005
    http://support.microsoft.com/default.aspx?scid=kb;en-us;843370 might help for the VS2003 issues.

    Otherwise search the KB with keyword kbvsnet2003presp1fix looking for fixes.
  • Anonymous
    May 25, 2005
    Make sure the indexing service is turned off.