我有一个C# webforms应用程序,直到今天一直在webforms地工作。


无法将文件“ obj \\ Debug \\ MyProject.exe”复制到“ bin \\ Debug \\ MyProject.exe”。 该进程无法访问文件“ bin \\ Debug \\ MyProject.exe”,因为它正在被另一个进程使用。

谷歌搜索错误不会带来明显的错误,即VS认为文件已锁定。 它是绝对的Visual Studio本身锁定文件,因为当我关闭VS并重新打开它,项目执行罚款-第一次。 当我尝试第二次运行它时,出现文件锁定错误。

每次我要运行该应用程序时,关闭VS并重新打开它都不可行! 如何找出锁定文件的内容,并阻止它被锁定?

编辑:另一个有趣的发现:我什至不必运行该应用程序。 编译一次会导致文件锁定。 我不能连续编译两次!

此问题特定于我的解决方案中的一个项目。 所有其他项目都可以正常工作,并且可以执行多次。 只是这个项目被锁定了。

I’ve got a C# webforms app, that until today had been working just swimmingly.Now today, all of a sudden, every time I try run the app, I get a file locking error:Unable to copy file “obj\\Debug\\MyProject.exe” to “bin\\Debug\\MyProject.exe”.The process cannot access the file “bin\\Debug\\MyProject.exe” because it is being used by another process.Googling the error doesn’t come up with anything beyond the obvious, ie VS thinks the file is locked.And it is definitely Visual Studio itself that locks the file, because when I close VS and reopen it, the project executes fine – the first time.When I try to run it a second time, I get the file locking error.Closing VS and reopening every time I want to run the app is not a viable workaround!How do I find out what’s locking the file, and stop it from getting locked?EDIT: Another interesting discovery: I don’t even have to run the app.Just compiling it once causes the file locking;I cannot compile twice in a row!This problem is specific to one project in my solution.All other projects work fine and can be executed as many times as I like.It’s only this one project that gets itself locked up.


在自动构建中使用devenv时,我一直收到此错误。 我已经浏览了我能找到的每个网站,并且通常的答案提到了刷新的依赖关系(我认为它修复了它用于手动部署,但不用于自动)并从项目中删除源代码控制编码,这对我没有帮助。



I have been receiving this error for a while when using devenv on an automatic build.I have gone through every website I can find, and the usual answers mention refreshing dependencies (Which I believe fixes it for manual deployment, but not for automatic) and removing the source control coding from the projects, which hasn’t helped me.The error does not occur every time I build, but it seems random on different deployment projects each time.Does anyone have any advice on why exactly this error occurs and how to go about fixing it?


我正在尝试部署ClickOnce应用程序,但在客户端上安装失败。 这是错误日志:

Windows             : 6.1.7601.65536 (Win32NT)
Common Language Runtime     : 4.0.30319.1
System.Deployment.dll       : 4.0.30319.1 (RTMRel.030319-0100)
clr.dll             : 4.0.30319.1 (RTMRel.030319-0100)
dfdll.dll           : 4.0.30319.1 (RTMRel.030319-0100)
dfshim.dll          : 4.0.31106.0 (Main.031106-0000)

Deployment url          : http://MyProduct.com/download/workstation/MyProduct%20Front%20Desk.application
                    Server      : Microsoft-IIS/7.5
                    X-Powered-By    : ASP.NET
Deployment Provider url     : http://MyProduct.com/Download/Workstation/MyProduct%20Front%20Desk.application
                    Server      : Microsoft-IIS/7.5
                    X-Powered-By    : ASP.NET
Application url         : http://MyProduct.com/Download/Workstation/Application%20Files/MyProduct%20Front%20Desk_1_0_0_7/MyProduct%20Front%20Desk.exe.manifest
                    Server      : Microsoft-IIS/7.5
                    X-Powered-By    : ASP.NET

Deployment Identity     : MyProduct Front Desk.application, Version=, Culture=neutral, PublicKeyToken=df343a0868ab2d74, processorArchitecture=msil
Application Identity        : MyProduct Front Desk.exe, Version=, Culture=neutral, PublicKeyToken=df343a0868ab2d74, processorArchitecture=msil, type=win32

* Installable application.

Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of http://MyProduct.com/download/workstation/MyProduct%20Front%20Desk.application resulted in exception. Following failure messages were detected:
    + Reference in the manifest does not match the identity of the downloaded assembly MyProductSiteServer.exe.

No transaction error was detected.

There were no warnings during this operation.

* [03/17/11 11:51:04] : Activation of http://MyProduct.com/download/workstation/MyProduct%20Front%20Desk.application has started.
* [03/17/11 11:51:04] : Processing of deployment manifest has successfully completed.
* [03/17/11 11:51:04] : Installation of the application has started.
* [03/17/11 11:51:05] : Processing of application manifest has successfully completed.
* [03/17/11 11:51:06] : Found compatible runtime version 4.0.30319.
* [03/17/11 11:51:06] : Request of trust and detection of platform is complete.

Following errors were detected during this operation.
* [03/17/11 11:51:30] System.Deployment.Application.InvalidDeploymentException (RefDefValidation)
    - Reference in the manifest does not match the identity of the downloaded assembly MyProductSiteServer.exe.
    - Source: System.Deployment
    - Stack trace:
        at System.Deployment.Application.DownloadManager.ProcessDownloadedFile(Object sender, DownloadEventArgs e)
        at System.Deployment.Application.FileDownloader.DownloadModifiedEventHandler.Invoke(Object sender, DownloadEventArgs e)
        at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
        at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
        at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
        at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
        at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
        at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
        at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
        at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

No transaction information is available.

我需要部署的主要exe是MyProductFrontDesk.exe ,它依赖于MyProductSiteServer.exe – 这似乎是抛出错误的位置:“清单中的引用与下载的程序集MyProductSiteServer.exe的标识不匹配“。

哪个清单需要纠正? 如何?

I’m trying to deploy a ClickOnce application, but installation fails on the client.Here’s the error log:The main exe I need to deploy is MyProductFrontDesk.exe , which has a dependency on MyProductSiteServer.exe – and that appears to be where the error is being thrown: “Reference in the manifest does not match the identity of the downloaded assembly MyProductSiteServer.exe.”Which manifest needs to be corrected?And how?





我还读到它是Windows SDK的一部分-但是当我寻找SignTool.exe的位置时-我在那里看到了它!

  C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin



While I was trying to Update my Project I was making – I got an error for the first time I’ve seen:’An error occurred while signing: SignTool.exe not found.’I’ve never seen this before, So I looked up that SignTool.exe is what signs my project for ClickOnce Deployment.I also read that is it a part of Windows SDK – but when I looked to find where SignTool.exe is – I saw it right there!I saw no problem, and I’ve always published my Project all the time – I’m on Version 68. But this is the first time I’ve seen this – I didn’t touch any options that would do this.Any help?


在Visual Studio 2010中,我有许多单元测试。 当我使用测试列表一次运行多个测试时,我有时会在一个或多个测试中发现以下错误:



在Connect上发现了这个错误报告 ,这似乎是同样的问题,但它没有提供解决方案。

有没有人见过这种行为? 我怎么能避免呢?


我仍然遇到这个错误,我的许多同事也在使用相同的软件/硬件设置。 到目前为止,我已经评估了答案,但他们没有解决问题。 我正在为这个问题找到解决方案。

In Visual Studio 2010, I have a number of unit tests.When I run multiple tests at one time using test lists, I sometimes reveive the following error for one or more of the tests:The agent process was stopped while the test was running.It is never the same test failing, and if I try to run the test again, it succeeds.I found this bug report on Connect , which seems to be the same problem, but it does not offer a solution.Has anyone else seen this behaviour ?How I can avoid it ?EditI am still experiencing this bug, and so is many of my colleagues on the same software/hardware setup.I have evaluated the answers so far, but they don’t resolve the problem.I am starting a bounty for a solution to this problem.