Visual Studio 2010 文件锁定阻止 ROBOCOPY 复制文件

发布于 2024-10-17 20:58:16 字数 919 浏览 2 评论 0原文

Windows 7 64 位上的 Visual Studio 2010 正在锁定 .aspx、.ascx、.css 和 .js 文件。我是一名前端 Web 开发人员,我编写了一个 ROBOCOPY 脚本,以防止我必须完整构建我们的解决方案。该解决方案一个构建后步骤,用于将所有 Web 资产文件(非编译文件)复制到部署目录中。问题是,这会触发 IIS 重新启动应用程序并需要重新登录,因此这是一个痛苦的选择,尤其是当我希望能够对 css、js 和 html 模板进行快速、增量更新时。

ROBOCOPY bat 文件:

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 输出:

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.

每次连续运行脚本时,都会在一个文件上释放锁定,然后在下一个文件上崩溃,直到最后,所有文件都复制过来。我已经尝试过 /W:n 标志,但锁定永远不会释放,直到我按 ctrl+C 然后重试。有没有办法让 robocopy 接受锁定的文件或让 VS2010 不锁定打开编辑的文件?

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 locked files or for VS2010 to not lock files that are open for editing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

長街聽風 2024-10-24 20:58:16

您可以使用 SysInternals 工具找出哪个进程正在锁定您的文件,我猜它是 Cassini 网络服务器。如果是这样,则可以使用带有 SP 1 Beta(测试版yikes)的 Visual Studio 2010 和 IIS Express 来代替 Cassini。我不知道这对您的开发环境是否有意义,或者当您想要进行 robocopy 时是否会阻止您的文件被锁定,但可能值得一看。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文