Visual Studio 2010 File Locking is blocking ROBOCOPY from copying files
Visual Studio 2010 on Windows 7 64bit is locking .aspx, .ascx, .css, and .js files. I'm a front-end web developer and I've written a ROBOCOPY script to prevent me from having to do a full build of our solution. The solution has a post-build step to copy all the web asset files (non compiled files) into the deploy directory. The problem is that this triggers IIS to restart the app and requires a re-login, so that's a painful option especially when I want to be able to make fast, incremental updates to the css, js, and html templates.
ROBOCOPY bat file:
robocopy C:\**sln dir**\Content C:\**deploy dir**\Content /MIR /ZB /B /XD "*.svn"
robocopy C:\**sln dir**\Views C:\**deploy dir**\Views /MIR /ZB /B /XD "*.svn"
robocopy C:\**sln dir**\Scripts C:\**deploy dir***\Scripts /MIR /ZB /B /XD "*.svn" "*.idea"
Cmd output:
2011/02/16 11:16:01 ERROR 32 (0x00000020) Copying File C:\*** etc ***\Edit.aspx
The process cannot access the file because it is being used by another process.
Every consecutive time I run the script, the lock is dropped on one file, then crashes on the next, until finally, all the files copy over. I have tried the /W:n flag, but the lock is never release until I ctrl+C then try again. Are there any ways to either get robocopy to accept loc开发者_JS百科ked files or for VS2010 to not lock files that are open for editing?
You can use the SysInternals tools to find out which process is locking your files, I'm guessing it's the Cassini webserver. If so, then Visual Studio 2010 with SP 1 Beta (beta yikes) and IIS Express can be used in place of Cassini. I don't know if this even makes sense for your development environment or if it would prevent your files from getting locked when you want to do the robocopy, but could be worth taking a peek at.
精彩评论