Visual Studio在生成时锁定输出文件 [英] Visual Studio locks output file on build

查看:153
本文介绍了Visual Studio在生成时锁定输出文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS 2010中有一个简单的WinForms解决方案.每当构建它时,输出文件(bin \ debug \ app.exe)最终都会被锁定,随后的构建会失败,并显示一条消息,例如 "The process cannot access the file 'bin\Debug\app.exe' because it is being used by another process." 生成项目的唯一方法是在每次生成后重新启动VS,这很尴尬.

I have a simple WinForms solution in VS 2010. Whenever I build it, output file (bin\debug\app.exe) ends up locked, and subsequent builds fail with a message like "The process cannot access the file 'bin\Debug\app.exe' because it is being used by another process." The only way to build the project is to restart VS after every build, which is very awkward.

我发现了这个旧博客帖子 http://blogs .geekdojo.net/brian/archive/2006/02/17/VS2005FileLocking.aspx -看来问题确实很老.有谁知道这里发生了什么,或者至少知道一些解决方法?

I have found this old blog post http://blogs.geekdojo.net/brian/archive/2006/02/17/VS2005FileLocking.aspx - it seems that the problem is really old. Does anyone know what is happening here, or at least some workaround?

更新

我实际上不是运行文件.锁定发生在构建之后,而不是调试之后(即启动VS-构建-构建-失败!) 我尝试关闭防病毒软件.这没有帮助.

I don't actually run the file. Locking happens after build, not after debug (i.e. start VS - build - build - fail!) And I tried turning antivirus off. It doesn't help.

更新2

进程浏览器显示devenv.exe已加载文件(在DLL中,而不是在Handles中).似乎在构建过程中出现了一些小故障阻止了卸载,但是(第一个)构建完成了,除了"1成功,失败"之外没有任何消息.

Process Explorer shows devenv.exe having loaded the file (in DLLs, not in Handles). It seems like some glitch during build prevented the unloading, but the (first) build completes without any messages other then "1 succeeded, o failed"/

推荐答案

我创建了一个新的空白解决方案,并将所有旧文件添加到其中.这样就解决了问题.

I have created a new blank solution and added all the old files to it. This somehow solved the problem.

这篇关于Visual Studio在生成时锁定输出文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆