Microsoft KB Archive/810110

= You receive a &quot;The process cannot access the file because it is being used by another process&quot; when you try to remove an image file from Solution Explorer in Visual Studio .NET 2002 and 2003 =

Article ID: 810110

Article Last Modified on 5/9/2007

-

APPLIES TO


 * Microsoft Common Language Runtime (included with the .NET Framework 1.1)
 * Microsoft Common Language Runtime (included with the .NET Framework) 1.0
 * Microsoft Visual Studio .NET 2003 Professional Edition
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition

-





SYMPTOMS
When you try to remove an image file from Solution Explorer in Microsoft Visual Studio .NET 2002 or 2003, you receive the following error message:

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



CAUSE
This problem occurs when a reference to the image is created and then the reference is later removed.

For example, the Image property of a PictureBox control is set to the image file. Later, the PictureBox control is removed from the Windows form. When you try to remove the image that was referenced in the PictureBox control, you receive an error message.

Note To perform Undo operations, Visual Studio .NET Designer may keep a lock on an image file where a reference is created and then is later removed.



WORKAROUND
To work around this problem, you must remove all references to the image and then restart Visual Studio .NET. After you restart Visual Studio .NET, you can remove the image file from Solution Explorer.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Steps to reproduce the behavior

 * 1) Start Visual Studio .NET.
 * 2) On the File menu, click New, click Project, and then click Visual Basic Projects.
 * 3) Click Windows Application, type  in the Name box, and then click OK.

Note Replace  with the name of your application.
 * 1) From Windows Explorer, copy an image file to Solution Explorer to add the image to the solution.
 * 2) Add a PictureBox control to the Windows form.
 * 3) Set the Image property of the PictureBox control to the image file that you added in step 4.
 * 4) On the File menu, click Save All.
 * 5) Delete the PictureBox control that you added in step 6 from the Windows form.
 * 6) In Solution Explorer, right-click the image file, and then click Delete.
 * 7) Click OK to confirm the deletion.

For more information about how to use Solution Explorer in Visual Studio .NET, visit the following Microsoft Developer Network (MSDN) Web site:

http://msdn2.microsoft.com/en-us/library/0ebzhwsk(vs.71).aspx

Additional query words: VS2002 VS2003

Keywords: kbgdiplus kbtshoot kbprb KB810110

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.