构建时输出文件被另一个进程锁定 [英] Output file locked by another process when building

查看:194
本文介绍了构建时输出文件被另一个进程锁定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2010通过Kinect SDK 1.6创建XNA应用程序.我有一个问题,在调试应用程序后,构建通常会失败(并非总是如此).有一个进程正在锁定KinectDrobePrototype1.exe.

I am using Visual Studio 2010 creating a XNA application with the Kinect SDK 1.6. I have a problem that the build usually fails (not always) after debugging the application. There is a process that is locking KinectDrobePrototype1.exe.

Error 12 Unable to copy file "obj\x86\Debug\KinectDrobePrototype1.exe" to 
"bin\x86\Debug\KinectDrobePrototype1.exe". The process cannot access the file
'bin\x86\Debug\KinectDrobePrototype1.exe' because it is being used by another
process.

Error 11 Could not copy "obj\x86\Debug\KinectDrobePrototype1.exe" to
"bin\x86\Debug\KinectDrobePrototype1.exe". Exceeded retry count of 10. Failed.  

我使用了 Process Explorer 告诉了我是System进程.

I have used Process Explorer which tells me it is the System process.

Process  |  PID  |  Type  |  Name
System       4      File     C:\Users\ ... \KinectDrobePrototype1\KinectDrobePrototype1\KinectDrobePrototype1\bin\x86\Debug\KinectDrobePrototype1.exe

我见过类似的帖子,例如,但它没有没有帮助.我觉得我的应用程序中一定有某些东西仍然可以处理某些东西.我肯定知道,当应用程序终止时,以下代码将在我的KinectManager类中执行.

I have seen similar posts like this but it hasn't helped. I feel that there must be something in my application that still has a handle on something. I know for certain that when the application terminates the following code executes within my KinectManager class.

public void CleanUp()
{
    if (ActiveKinectDevice != null)
        UnintialiseDevice(ActiveKinectDevice);
}

private void UnintialiseDevice(KinectSensor device)
{
    device.Stop();

    device.ColorStream.Disable();
    _ColourPixelData = null;

    device.DepthStream.Disable();
    _DepthPixelData = null;

    device.SkeletonStream.Disable();
    _SkeletonData = null;
}

我对XNA还是很陌生,所以可能有些事情我还没做完.在UnloadContent上,我有以下内容:

I am very new to XNA so it possible that there is something I have not done. On the UnloadContent I have the following:

protected override void UnloadContent()
{
    _KinectManager.CleanUp();
    _DrawingManager.CleanUp();           
}

然后在我的DrawingManager类中,我处理掉我曾经使用过的一些纹理,即我的SpriteBatchGraphicsDevice:

And then in my DrawingManager class I dispose of the few textures I have used, my SpriteBatch and GraphicsDevice:

public void CleanUp()
{
    HandIcon.Dispose();
    JointIcon.Dispose();
    _ColourImage.Dispose();
    _DepthImage.Dispose();

    _SpriteBatch.Dispose();
    _GraphicsDevice.Dispose();           
}

有人有任何建议吗?还是我犯了一个明显的错误?

Has anyone got any suggestions? Or is there an obvious mistake that I have made?

我忘了提到我正在使用Kinect的轮询方法,这就是为什么我没有取消任何事件的注册的原因.

Edit 1: I forgot to mention that I am using the polling method for the Kinect, which is why I have not unregistered for any events.

为澄清起见,系统进程最终会释放文件-它不会保持锁定状态.我认为这通常需要一到两分钟.

Edit 2: For clarification, the System process does release the file eventually - it does not stay locked. I think this usually takes between one to two minutes.

更新1:我确实安装了防病毒软件.我已将其禁用,但尚未解决问题.

Update 1: I do have antivirus software installed. I have disabled it but it has not solved the issue.

更新2:我可以确认这是我的台式机特有的问题.我尚未在笔记本电脑上重现该问题.

Update 2: I can confirm this is a problem specific to my desktop machine. I am yet to reproduce the problem on my laptop.

推荐答案

我在一个论坛上找到了一个讨论,标题为''.

I found a discussion on a forum with the title 'System process "anomaly"'.

这摘自Jblom1986的帖子.他的解决方案解决了我的问题.要进行更改,请使用 msconfig.exe 进入服务标签.

This is taken from Jblom1986's post. His solution solved my problem. To make the changes go to the services tab using msconfig.exe.

关闭名为'应用程序体验'的Windows服务(当发生崩溃时该服务会在Microsoft数据库中找到解决方案的服务),另一个名为'搜索索引器'的服务(负责通过索引在驱动器上快速查找文件的服务)开始出现故障.因此,Windows会锁定您移动,复制或使用了几分钟的所有内容,以在释放前对该文件进行索引"之后,您可以删除该文件.它以进程ID号4(PID:4)锁定它.

"When the windows service named 'Application Experience' (a service which when something crashes finds a solution in the microsoft database) is turned off, another service named 'Search Indexer' (a service which is responsible for quickly finding files on a drive by indexing them) starts to malfunction. As a result, windows locks anything you have moved, copied or used for a few minutes to 'index' this file before releasing it after which you can delete that same file. It locks it with Process ID number 4 (PID:4)".

编辑:这是在Windows 7计算机上.我不确定其他Windows版本是否出现此错误.

This was on a Windows 7 machine. I'm not sure if other versions of Windows have this error.

这篇关于构建时输出文件被另一个进程锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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