This post originated from an RSS feed registered with .NET Buzz
by Scott Hanselman.
Original Post: "Could Not Copy Temporary Files to the Output Directory" and big VS.NET projects
Feed Title: Scott Hanselman's ComputerZen.com
Feed URL: http://radio-weblogs.com/0106747/rss.xml
Feed Description: Scott Hanselman's ComputerZen.com is a .NET/WebServices/XML Weblog. I offer details of obscurities (internals of ASP.NET, WebServices, XML, etc) and best practices from real world scenarios.
A fellow emailed me about the troubles he was having with his VS.NET solution.
He's trying to build into a shared binaries folder and is using direct Assembly references
(rather than project references.)
In fact, it appears that Intellisense is locking his assemblies just long enough to
get one of the dreaded:
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.
The moral? We use NAnt for all builds. It's fairly simple, repeatable,
and IJW. Otherwise, if your goal is to get all files to a shared bin, use a
Post Build Event.