BUG: Your build cannot continue because a file is in use (811593)



The information in this article applies to:

  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition

SYMPTOMS

When you build an application, you receive an error message that indicates that the build cannot continue because a file is in use. This may occur in the following cases:
  • ProjectA has CopyLocal=False on its reference to ProjectB.
  • Projects in a solution build to a common output directory.
In both of these cases, the assemblies that are generated or referenced are greater than or equal to 64 kilobytes (KB).

CAUSE

When you start a project, and you set CopyLocal=False or you build to a common output directory, the locking behavior does not occur. As you continue to work with the project and your assembly grows, this behavior eventually occurs. The Microsoft .NET Framework common language runtime locks loaded assemblies that are greater than or equal to 64 KB. When an assembly becomes larger than 64 KB, the runtime pages the assembly in memory to improve performance.

RESOLUTION

  • Verify that CopyLocal is set to True on all project-to-project references.

    Note True is the default setting in Microsoft Visual Studio .NET 2003. To change this property, follow these steps:
    1. In Solution Explorer, click the reference name under References.
    2. Under Properties, view the properties for that reference, and then make any appropriate changes.
  • Verify that all the projects in the solution build to different output directories. Each project should have its own output directory that is not written to by any other project that is in the same solution or that is in a different solution.

    Note This is the default setting in Visual Studio .NET 2003.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

Modification Type:MinorLast Reviewed:3/6/2006
Keywords:kbvs2005doesnotapply kbvs2005swept kbpending kbbug KB811593 kbAudDeveloper