FIX: You may receive the "Cannot copy assembly" error message when you try to build a Visual C# .NET solution in Visual Studio .NET 2003 (887818)



The information in this article applies to:

  • Microsoft Visual C# .NET (2003)

SYMPTOMS

When you try to build a Microsoft Visual C# .NET solution in Microsoft Visual Studio .NET 2003, the solution build operation fails. You may receive an error message that is similar to the following:
Cannot copy assembly <Referenced Assembly> to file <Current Project Output Folder>\bin\Debug\Release\<Referenced Assembly>.dll. The process cannot access the file because it is being used by another process.
Note Typically, this problem does not occur after you restart Visual Studio .NET 2003.

CAUSE

This problem occurs because the file that contains the referenced assembly is locked by another process. The IDE opens a handle to the file and then does not close the handle as expected. When the IDE cannot update the file, you may receive the error message. The file remains locked until you restart the IDE.

Note Verify that you are not building all your assemblies in the same output directory.

For additional information about conditions that may cause dependent DLLs to be locked during a Visual Studio .NET 2003 build, click the following article number to view the article in the Microsoft Knowledge Base:

313512 BUG: "Could not copy temporary files to the output directory" error message when you build a solution that contains multiple projects

RESOLUTION

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Visual Studio .NET 2003 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

Visual Studio .NET 2003

Restart requirement

You do not have to restart your computer after you apply this hotfix.

Hotfix replacement information

This hotfix does not replace any other hotfixes.

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time   Version       Size    File name     
   -------------------------------------------------------
   16-Oct-2004  12:26  7.10.4290.0  798,720  Cslangsvc.dll

STATUS

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

MORE INFORMATION

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

843370 FIX: "Cannot copy assembly" error message during the build process after you use the Get Latest command to retrieve solution files from Visual SourceSafe

824684 Description of the standard terminology that is used to describe Microsoft software updates


Modification Type:MajorLast Reviewed:5/15/2006
Keywords:kbtshoot kbVSNET2003sp1fix kbfix kbbug kbHotfixServer KB887818 kbAudDeveloper