BUG: "Could not copy temporary files to the output directory" error message when you build a solution that contains multiple projects (313512)
The information in this article applies to:
- Microsoft Visual Studio .NET (2003), Professional Edition
- Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2003), Academic Edition
- Microsoft Visual Studio .NET (2003), Trial Edition
- Microsoft Visual Studio .NET (2002), Professional Edition
- Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2002), Academic Edition
- Microsoft Visual Studio .NET (2002), Trial Edition
This article was previously published under Q313512 SYMPTOMS When you build a solution that contains multiple projects
in Visual Studio .NET, you may receive one of the following error messages: Error message 1
Could not copy temporary files to the output directory.
The file 'assembly name' cannot be copied to
the run directory. The process cannot access the file because it is being used
by another process. Error message 2 error CS0016: Could not write to output file 'fully qualified path of an assembly' -- 'The process cannot access the file because it is being used by another process. ' Error message 3 Cannot delete the project output: is the file read-only?
A failure occurred while attempting to start the application.
Error message 4 ProjectName: error PRJ0008 : Could not delete file 'Managed C++ Output DLL'. Make sure that the file is not open by another process and is not write-protected.
When you try to build a solution that contains an .exe project, and the solution also depends on a second Class Library project or DLL Assembly, you may receive a build error message that is similar to the following: The type or namespace name 'XXXXX' could not be found. (Are you missing a using directive or an assembly reference?) Cannot copy assembly 'Tools' to file 'I:\samplesViews\Bin\Debug\XXXXX.dll'. The process cannot access the file because it is being used by another process. The error message is generated on every other build of the solution. CAUSE This problem may occur when one of the assemblies that you
compile is larger than 64 kilobytes (KB) and one (or both) of the following
conditions is true:
- Your solution contains projects that are compiled to the
same output folder.
- The Copy Local property on one of the referenced assemblies or projects is set
to False.
RESOLUTION To work around this problem, do any (or all) of the
following, as appropriate for your projects:
- Compile the outputs for individual projects to different
folders. Visual Studio .NET 2002 and Visual Studio .NET 2003 do not support a
common output folder.
- Set the Copy Local property for the referenced assembly or project to True.
- Verify that you do not have the Object Browser window
open.
- Verify that you do not have the same project (or projects)
open in another instance of Visual Studio .NET.
Note Microsoft strongly recommends that you use project references
instead of assembly references. Assembly references do not contribute to the
file locking problem. However, when you use assembly references, you must set
the build order manually. When you use project references, the build order is
established automatically. STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed in the "Applies to"
section.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
311491
The
"could not copy temporary files to the output directory" error is generated in
Visual Studio .NET
Modification Type: | Minor | Last Reviewed: | 1/26/2006 |
---|
Keywords: | kbvs2005doesnotapply kbvs2005swept kbtshoot kbvs2002sp1sweep kbfix kbbug kberrmsg kbProd2Web KB313512 kbAudDeveloper |
---|
|