Article ID: 313512 - Last Review: January 26, 2006 - Revision: 7.5 BUG: "Could not copy temporary files to the output directory" error message when you build a solution that contains multiple projectsThis article was previously published under Q313512 On This PageSYMPTOMS 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 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. ' Cannot delete the project output: is the file read-only?
A failure occurred while attempting to start the application.
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. 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:
RESOLUTION To work around this problem, do any (or all) of the
following, as appropriate for your projects:
STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed in the "Applies to"
section. MORE INFORMATIONThis problem occurs when the IntelliSense engine of the
project locks a referenced assembly. The IntelliSense engine locks only those
referenced assemblies that are larger than 64 KB. To resolve this assembly locking problem, the master copy of the referenced assembly must be left unlocked. You must provide another "lockable" copy of the referenced assembly to the IntelliSense engine. If the assembly reference has the Copy Local property set to True, and the project is being built to its own output directory, a lockable copy of the referenced assembly already exists. The Copy Local property determines whether a private copy of a reference will be copied to the output path of the project. When a reference is added, the default value for this property is computed by the project system. Microsoft strongly recommends that you do not change this default value. Therefore, when you have the Copy Local property set to True for the referenced assembly, the IntelliSense engine locks this private copy of the assembly in the local Bin folder. This private copy of the assembly is automatically updated each time that the master copy of the assembly is rebuilt. Steps to reproduce the behaviorThis article describes two different scenarios to reproduce this problem:
Note Verify that the line numbers appear in your C# code editor. Step 8 is easier to do when the line numbers are visible.
Common output folder
Copy Local is set to FALSENote If you have tried the steps in the "Common Output Folder" scenario, Visual Studio .NET will lock MyLibrary.dll. To try the steps in the "Copy Local Is Set to FALSE" scenario, you must quit Visual Studio .NET, and then delete the C:\Test\MyLibrary\obj folder.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
311491
(http://support.microsoft.com/kb/311491/
)
The
"could not copy temporary files to the output directory" error is generated in
Visual Studio .NET
APPLIES TO
| Article Translations
|
Back to the top
