Не удалось скопировать obj debug windows forms

I have a project in C# and I get this error every time I try to compile the project: (Unable to copy file "objDebugProject1.exe" to "binDebugProject1.exe". The process cannot access the file...

I have a project in C# and I get this error every time I try to compile the project:

(Unable to copy file «objDebugProject1.exe» to «binDebugProject1.exe». The process cannot access the file ‘binDebugProject1.exe’ because it is being used by another process.)

So I have to close the process from the task manager. My project is only one form and there is no multi-threading.

What is the solution (without restarting VS or killing the process)?

enter image description here

valiano's user avatar

valiano

15.4k7 gold badges58 silver badges76 bronze badges

asked Apr 12, 2010 at 20:32

Mohamad Alhamoud's user avatar

Mohamad AlhamoudMohamad Alhamoud

4,9118 gold badges33 silver badges44 bronze badges

3

This should work.

Go to your project properties.
Inside Build Events, under Pre-build event command line, add these two lines of code:

if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"

answered Jun 8, 2015 at 6:57

chaosifier's user avatar

3

@Udpate: Since the time I was first posting this ‘answer’, I tend to another explanation to the problem. The issue since than happened more and more often outside of Visual Studio also — while trying to copy an .exe file from one folder to another. While in the first place Windows did not allow to copy(!) an .exe file (it was first asking me for administrative rights but refused to copy it afterwards anyway) it still showed up in the explorer. But after a while — without any further action taken, it disappeared magically. Just like the problem in the question always seems to solve itself after a while. So i assume, the problem is more related to a delayed deletion of the project output file and less a buggy VS. I apologize for any unjustified suspicion. :|

This gives the search for a solution a complete different direction, I guess. Did find that link and will update on any progress:

https://superuser.com/questions/234569/windows-7-delayed-file-delete

========================================================================

This is a known bug in VS. I discovered it very often — mostly in VS2010 (with/without SP1). Several «solutions» are recommended. Some of them, which kind of helped for me:

  1. Delete the .suo file in your project dir. Eventually need to create your whole solution from scratch.
  2. Close any Windows Form Designers may remain open.
  3. Use a prebuild script, which deletes the target from the output dir.
  4. Disable the VS hosting process.

None of these really fixes the bug. But it may brings the VS back to a usable state — until a true solution is provided by MS (if ever will).

http://social.msdn.microsoft.com/Forums/en/vsdebug/thread/cea5e4b2-5b33-453c-bffb-8da9f1a1fa4a

http://social.msdn.microsoft.com/Forums/en/vbide/thread/cd12f3c7-de96-4353-adce-23975e30933f

Community's user avatar

answered Feb 8, 2011 at 6:39

user492238's user avatar

user492238user492238

4,0741 gold badge20 silver badges26 bronze badges

4

I can confirm this bug exists in VS 2012 Update 2 also.

My work-around is to:

  1. Clean Solution (and do nothing else)
  2. Close all open documents/files in the solution
  3. Exit VS 2012
  4. Run VS 2012
  5. Build Solution

I don’t know if this is relevant or not, but my project uses «Linked» in class files from other projects — it’s a Silverlight 5 project and the only way to share a class that is .NET and SL compatible is to link the files.

Something to consider … look for linked files across projects in a single solution.

LarsTech's user avatar

LarsTech

80.1k14 gold badges150 silver badges222 bronze badges

answered May 10, 2013 at 22:26

Rob Ainscough's user avatar

3

This is happening because [yourProjectName].exe process is not closing after finishing debugging.

There are two solutions to this problem.

  1. Every time you make change to application, Go to Task Manager -> Processes -> [yourProjectName].exe, end this process. You have to end this process every time you make changes to system.

  2. Add a exit button in your application to exit window and add these line to click event

    System.Diagnostics.Process.GetCurrentProcess().Kill();
    Application.Exit();
    

Michael Petrotta's user avatar

answered Sep 2, 2012 at 6:40

rajan's user avatar

rajanrajan

1311 silver badge2 bronze badges

The real problem isn’t the error you’re getting; it’s that the application isn’t cleaning up after itself.

It’s either holding on to references, not freeing resources, or something else that’s causing the process to not end when it’s being told to close. Fix up that issue and this problem will resolve itself. We can’t really help you with that unless you post your code (and at this point, if you need help with that, you should start a new question).

answered Apr 12, 2010 at 20:35

Jon Seigel's user avatar

Jon SeigelJon Seigel

12.1k8 gold badges57 silver badges92 bronze badges

2

I had to go into windows explorer and delete the bin/debug folder as well as the obj/debug folders. Then I cleaned & rebuilt the project.

answered Oct 21, 2015 at 18:34

coggicc's user avatar

coggicccoggicc

2451 gold badge5 silver badges13 bronze badges

1

  1. Close your project
  2. Delete bin folder

i find it work, :)

answered Jun 11, 2016 at 17:11

Novpiar Effendi's user avatar

Rename the assembly to a different name to solve this issue.

answered May 14, 2018 at 14:03

Sofia Khwaja's user avatar

Sofia KhwajaSofia Khwaja

1,7993 gold badges16 silver badges20 bronze badges

After seeing a similar error in visual studios 2012 out of no where. I have found that that going to the root folder of the project and right clicking on it I unchecked read only and this error went away. Apparently TFS sometimes will made a folder read only. Hopefully this will help anyone with a similar issue. Thanks

answered Mar 14, 2013 at 19:16

0

This happened to me at VS 2010 and Win 7..
Case :

  • I can not Rebuild with Debug Configuration manager, but I can rebuild with Release Configuration manager

debug

What I have tried:

  • Check my account type at control panel — user account —> My Account is Administrator

cpanel

  • Set the bin folder not read only

not read only

  • Add security at bin folder to Everyone

everyone

  • stop the iis server

iis stop

  • Stop antivirus, check ridiculous running program using task manager and ProcessExplorer

  • run VS as administrator

If All that way is still not working.

Then, the last way to try:

  • close solution
  • close visual studio
  • start — shutdown
  • press power button to turn on the computer
  • login to your account which has administrator previlege at user type
  • reopen solution
  • rebuild
  • that way working. All people call this way as Reset Computer

answered Feb 13, 2015 at 4:35

Khaneddy2013's user avatar

Khaneddy2013Khaneddy2013

1,2311 gold badge17 silver badges24 bronze badges

0

Mine got solved by:

  1. Clean solution
  2. Close all processes depending on VS (Current instances).
  3. Rebuild

answered May 11, 2018 at 6:10

Esther Lalremruati's user avatar

I had same problem, after read your answers , went to Task Manager and searched for app.exe because i believe maybe it doesn’t close .
And found it , select it and do END TASK .my problem solved.

answered Mar 21, 2014 at 8:49

Hamid Talebi's user avatar

Hamid TalebiHamid Talebi

1,3482 gold badges24 silver badges42 bronze badges

Before rebuild the solution, clear the project, stop the IIS and open the «bin» folder property. Uncheck the Read-only Attribute in general tab then rebuild.

answered Nov 4, 2013 at 15:19

Kadir Ercetin's user avatar

1

I found that ending all msbuild.exe tasks (in Task Manager) fixed the issue with VS2012.

answered Jul 10, 2014 at 16:22

mizzle's user avatar

mizzlemizzle

5781 gold badge6 silver badges23 bronze badges

I struggeled with this since years.
I finally downloaded LockHunter to find out who locked the file.
In my case it was MBAM.
Once I added my project’s directory to MBAMs exclusion list, I didn’t have this problem anymore.

answered Sep 6, 2017 at 10:45

tmighty's user avatar

tmightytmighty

10.4k21 gold badges97 silver badges207 bronze badges

I too had the same issue. I resolved it

Closed my VS, then in Task Manager, End tasks like Microsoft VisualStudio WCF Tools, MSBuild.exe

Then open VS and clean and rebuild.

answered Oct 22, 2019 at 5:05

Ajoe's user avatar

AjoeAjoe

1,3173 gold badges19 silver badges47 bronze badges

No matter what the cause of this problem is, the only working solution for me is the following:

Go to Your-Project-Properties -> Application tab(first tab) -> Change the Assembly name.

This way your app creates a new assembly file each time you change the assembly name.

Finally, after you finish to develop, you can delete all those extra assembly files and just keep the last one (main one). Non of the other solutions worked for me, except this one.

Andre Hofmeister's user avatar

answered Dec 14, 2019 at 13:27

Coder Warrior's user avatar

Run Visual Studio as Administrator

answered Apr 18, 2013 at 9:12

Alexander Trofimov's user avatar

We recently experienced this on a WinPhone 8 project, in VS 2012 Update 2.

Inexplicably, the cause was using the Tuple type. Removing the code that used a Tuple the problem went away. Add the code back the problem returned.

answered Jun 5, 2013 at 12:46

Seamus's user avatar

SeamusSeamus

3,1913 gold badges22 silver badges20 bronze badges

This will Sound crazy, when ever i build the project the error will be displayed and the avast antivirus will show it as malicious attempt and the project does not run.i just simply disable my antivirus and build my solution again the missing .EXE file has been Created and the project has been successfully executed.

Or you can try this

Visual Studio build fails: unable to copy exe-file from objdebug to bindebug

Community's user avatar

answered Jun 17, 2013 at 11:51

coolprarun's user avatar

coolpraruncoolprarun

1,1332 gold badges15 silver badges22 bronze badges

I solved this by killing XDesProc which had a handle on the DLL it couldn’t delete.

answered Aug 15, 2013 at 16:59

Charlie's user avatar

CharlieCharlie

8,3612 gold badges53 silver badges52 bronze badges

Well i have the same problem, my way to fix it was to stop and disable the «application experience» service in Windows.

answered Feb 3, 2014 at 15:14

Kataku's user avatar

KatakuKataku

1351 gold badge1 silver badge12 bronze badges

Not a direct answer to your question..

One scenario when this can come is listed below —

If your application is under Debugging process — say by «Attach to Process» debugging, this error may come

answered Apr 16, 2014 at 14:29

LCJ's user avatar

LCJLCJ

22.4k64 gold badges255 silver badges412 bronze badges

If this error was encountered, you can proceed as the following

  1. End the msbuild.exe task
  2. End the explorer.exe task
  3. Run the explorer.exe task again

answered Jun 16, 2015 at 5:53

zawhtut's user avatar

zawhtutzawhtut

8,2535 gold badges50 silver badges76 bronze badges

for me it was the antivirus. Just add visual studio project or entire parent folder to Antivirus exclusion list or you can also add file extension as exclusion and this method worked for me in visual studio 2010/2012

answered Jul 1, 2015 at 1:33

Alex's user avatar

AlexAlex

9491 gold badge10 silver badges22 bronze badges

Solution1:

  1. Close the project.
  2. Delete the bin folder.
  3. Open the project.
  4. Build the project.

Solution2:

Add the following code in pre-build event:

attrib -r $(OutDir)*..* /s

This command line code will remove the ready-only attribute of «bin» folder. Now visual studio can easily delete and copy new dlls.

answered May 12, 2017 at 13:50

Rocky's user avatar

RockyRocky

4057 silver badges16 bronze badges

A very simple solution is to open the Task Manager (CTRL + ALT + DELETE), go to Processes tab and search by name the processes with your project name that are still running. Kill all the processes and go on ! :)

answered Dec 28, 2017 at 19:09

Dina Bogdan's user avatar

Dina BogdanDina Bogdan

4,0474 gold badges26 silver badges52 bronze badges

after day with search and build and rebuild i found that you just need to turn off turn on the visual studio its look like it catch the service in different thread

answered Jan 31, 2018 at 7:32

moath naji's user avatar

moath najimoath naji

6631 gold badge4 silver badges20 bronze badges

My Visual studio 2019 suddenly stops and restarts and then when i run project this error comes.

I resolve this issue by going into my project folder and delete bin and obj folder
Then clean and rebuild my project. This resolve my issue.

answered May 24, 2019 at 19:01

mehmoodnisar125's user avatar

  • Remove From My Forums
  • Question

  • Hi there! I am specifically using Visual Studio 2013:Windows Forms Application version 3.5 and this error log keeps popping up! I keep seeing stuff like visual C#, but
    how do I fix this?

    Error Log:

    Error 1 Unable to copy file «objDebugProject.exe» to «binDebugProject.exe». Access to the path ‘objDebugProject.exe’ is denied. Project

Answers

  • Check the Task Manager and see if the «Project.exe» is in use, or maybe another program is locking the built assembly of your project. Try to close the VS IDE and reopen the project. If this doesn’t work, use Process Explorer to find the
    using process.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click
    HERE to participate the survey.

    • Marked as answer by

      Monday, March 9, 2015 7:10 AM

  • Remove From My Forums
  • Question

  • Hi there! I am specifically using Visual Studio 2013:Windows Forms Application version 3.5 and this error log keeps popping up! I keep seeing stuff like visual C#, but
    how do I fix this?

    Error Log:

    Error 1 Unable to copy file «objDebugProject.exe» to «binDebugProject.exe». Access to the path ‘objDebugProject.exe’ is denied. Project

Answers

  • Check the Task Manager and see if the «Project.exe» is in use, or maybe another program is locking the built assembly of your project. Try to close the VS IDE and reopen the project. If this doesn’t work, use Process Explorer to find the
    using process.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click
    HERE to participate the survey.

    • Marked as answer by

      Monday, March 9, 2015 7:10 AM

Update: A sample project reproducing this bug can be found here at Microsoft Connect. I have also tested and verified that the solution given in the accepted answer below works on that sample project. If this solution doesn’t work for you, you are probably having a different issue (which belongs in a separate question).


This is a question asked before, both here on Stack Overflow and other places, but none of the suggestions I’ve found this far have helped me, so I just have to try asking a new question.

Scenario: I have a simple Windows Forms application (C#, .NET 4.0, Visual Studio 2010). It has a couple of base forms that most other forms inherit from, it uses Entity Framework (and POCO classes) for database access. Nothing fancy, no multi-threading or anything.

Problem: All was fine for a while. Then, all out of the blue, Visual Studio failed to build when I was about to launch the application. I got the warning «Unable to delete file ‘…binDebug[ProjectName].exe’. Access to the path ‘…binDebug[ProjectName].exe’ is denied.» and the error «Unable to copy file ‘objx86Debug[ProjectName].exe’ to ‘binDebug[ProjectName].exe’. The process cannot access the file ‘binDebug[ProjectName].exe’ because it is being used by another process.» (I get both the warning and the error when running Rebuild, but only the error when running Build — don’t think that is relevant?)

I understand perfectly fine what the warning and error message says: Visual Studio is obviously trying to overwrite the exe-file while it at the same time has a lock on it for some reason. However, this doesn’t help me find a solution to the problem… The only thing I’ve found working is to shut down Visual Studio and start it again. Building and launching then work, until I make a change in some of the forms, then I have the same problem again and have to restart… Quite frustrating!

As I mentioned above, this seems to be a known problem, so there are lots of suggested solutions. I’ll just list what I’ve already tried here, so people know what to skip:

  • Creating a new clean solution and just copy the files from the old solution.

  • Adding the following to the following to the project’s pre-build event:

     if exist "$(TargetPath).locked" del "$(TargetPath).locked"
        if not exist "$(TargetPath).locked" if exist "$(TargetPath)" move "$(TargetPath)" "$(TargetPath).locked"
    
  • Adding the following to the project properties (.csproj file):

     <GenerateResourceNeverLockTypeAssemblies>true</GenerateResourceNeverLockTypeAssemblies>
    

However, none of them worked for me, so you can probably see why I’m starting to get a bit frustrated. I don’t know where else to look, so I hope somebody has something to give me! Is this a bug in VS, and if so is there a patch? Or has I done something wrong, do I have a circular reference or similar, and if so how could I find out?

Any suggestions are highly appreciated :)

Update: As mentioned in the comment below, I’ve also checked using Process Explorer that it actually is Visual Studio that is locking the file.

Update: A sample project reproducing this bug can be found here at Microsoft Connect. I have also tested and verified that the solution given in the accepted answer below works on that sample project. If this solution doesn’t work for you, you are probably having a different issue (which belongs in a separate question).


This is a question asked before, both here on Stack Overflow and other places, but none of the suggestions I’ve found this far have helped me, so I just have to try asking a new question.

Scenario: I have a simple Windows Forms application (C#, .NET 4.0, Visual Studio 2010). It has a couple of base forms that most other forms inherit from, it uses Entity Framework (and POCO classes) for database access. Nothing fancy, no multi-threading or anything.

Problem: All was fine for a while. Then, all out of the blue, Visual Studio failed to build when I was about to launch the application. I got the warning «Unable to delete file ‘…binDebug[ProjectName].exe’. Access to the path ‘…binDebug[ProjectName].exe’ is denied.» and the error «Unable to copy file ‘objx86Debug[ProjectName].exe’ to ‘binDebug[ProjectName].exe’. The process cannot access the file ‘binDebug[ProjectName].exe’ because it is being used by another process.» (I get both the warning and the error when running Rebuild, but only the error when running Build — don’t think that is relevant?)

I understand perfectly fine what the warning and error message says: Visual Studio is obviously trying to overwrite the exe-file while it at the same time has a lock on it for some reason. However, this doesn’t help me find a solution to the problem… The only thing I’ve found working is to shut down Visual Studio and start it again. Building and launching then work, until I make a change in some of the forms, then I have the same problem again and have to restart… Quite frustrating!

As I mentioned above, this seems to be a known problem, so there are lots of suggested solutions. I’ll just list what I’ve already tried here, so people know what to skip:

  • Creating a new clean solution and just copy the files from the old solution.

  • Adding the following to the following to the project’s pre-build event:

     if exist "$(TargetPath).locked" del "$(TargetPath).locked"
        if not exist "$(TargetPath).locked" if exist "$(TargetPath)" move "$(TargetPath)" "$(TargetPath).locked"
    
  • Adding the following to the project properties (.csproj file):

     <GenerateResourceNeverLockTypeAssemblies>true</GenerateResourceNeverLockTypeAssemblies>
    

However, none of them worked for me, so you can probably see why I’m starting to get a bit frustrated. I don’t know where else to look, so I hope somebody has something to give me! Is this a bug in VS, and if so is there a patch? Or has I done something wrong, do I have a circular reference or similar, and if so how could I find out?

Any suggestions are highly appreciated :)

Update: As mentioned in the comment below, I’ve also checked using Process Explorer that it actually is Visual Studio that is locking the file.

25 ответов

@Udpate: с тех пор, как я впервые опубликовал этот «ответ», я склоняюсь к другому объяснению проблемы. Проблема с тех пор происходила все чаще и чаще за пределами Visual Studio — при попытке скопировать файл .exe из одной папки в другую. Хотя в первую очередь Windows не разрешала копировать (!) Файл .exe(сначала он просил меня об административных правах, но в любом случае отказался его копировать), он все еще появился в проводнике. Но через какое-то время — без каких-либо дальнейших действий оно исчезло волшебным образом. Точно так же, как проблема в вопросе всегда, кажется, решает себя через некоторое время. Поэтому я предполагаю, что проблема связана скорее с отложенным удалением выходного файла проекта и с меньшей ошибкой VS. Прошу прощения за любые необоснованные подозрения.: |

Это дает поиск решения совершенно другого направления, я думаю. Нашел эту ссылку и будет обновлять любой прогресс:

https://superuser.com/questions/234569/windows-7-delayed-file-delete

=============================================== =========================

Это известная ошибка в VS. Я обнаружил это очень часто — в основном в VS2010 (с/без SP1). Рекомендуется несколько «решений». Некоторые из них, которые помогли мне:

  • Удалите файл .suo в директории проекта. В конце концов вам нужно создать все свое решение с нуля.
  • Закрыть любые конструкторы форм Windows могут оставаться открытыми.
  • Используйте prebuild script, который удаляет цель из выходного каталога.
  • Отключите процесс хостинга VS.

Ни один из них не исправляет ошибку. Но это может привести VS обратно в пригодное для использования состояние — пока истинное решение не будет предоставлено MS (если когда-либо будет).

http://social.msdn.microsoft.com/Forums/en/vsdebug/thread/cea5e4b2-5b33-453c-bffb-8da9f1a1fa4a

http://social.msdn.microsoft.com/Forums/en/vbide/thread/cd12f3c7-de96-4353-adce-23975e30933f

user492238
08 фев. 2011, в 07:18

Поделиться

Я могу подтвердить, что эта ошибка существует и в обновлении версии VS 2012.

Моя работа — это:

  • Очистить решение (и ничего не делать)
  • Закройте все открытые документы/файлы в решении
  • Выход VS 2012
  • Выполнить VS 2012
  • Решение для сборки

Я не знаю, является ли это актуальным или нет, но мой проект использует «Связанный» в файлах классов из других проектов — это проект Silverlight 5 и единственный способ разделить класс, совместимый с .NET и SL, для связывания файлов.

Что-то, что нужно рассмотреть… искать связанные файлы по проектам в одном решении.

Rob Ainscough
10 май 2013, в 22:47

Поделиться

Это должно работать.

Перейдите к свойствам вашего проекта.
Внутри событий сборки в командной строке события Pre-build добавьте эти две строки кода:

if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"

chaosifier
08 июнь 2015, в 08:08

Поделиться

Реальная проблема — не ошибка, которую вы получаете; что приложение не очищается после себя.

Он либо держится за ссылки, не освобождает ресурсы, либо что-то еще, что заставляет процесс не заканчиваться, когда ему говорят закрыть. Устраните эту проблему, и эта проблема решится сама. Мы не можем вам помочь, если вы не разместите свой код (и в этот момент, если вам нужна помощь в этом, вы должны начать новый вопрос).

Jon Seigel
12 апр. 2010, в 22:16

Поделиться

Мне пришлось зайти в Windows Explorer и удалить папку bin/debug, а также папки obj/debug. Затем я очистил и перестроил проект.

coggicc
21 окт. 2015, в 18:38

Поделиться

Увидев подобную ошибку в визуальных студиях 2012 года, нет. Я обнаружил, что, перейдя в корневую папку проекта и щелкнув правой кнопкой мыши, я снял флажок только для чтения, и эта ошибка исчезла. По-видимому, TFS иногда делает доступной только папку. Надеюсь, это поможет любому, у кого есть аналогичная проблема. Благодаря

user2171331
14 март 2013, в 20:34

Поделиться

Это происходит потому, что процесс [yourProjectName].exe не закрывается после завершения отладки.

Существует два решения этой проблемы.

  • Каждый раз, когда вы вносите изменения в приложение, перейдите в Диспетчер задач → Процессы → [yourProjectName].exe, завершите этот процесс. Вы должны завершить этот процесс каждый раз, когда вы вносите изменения в систему.

  • Добавьте кнопку выхода в приложение для выхода из окна и добавьте эту строку в событие click

    System.Diagnostics.Process.GetCurrentProcess().Kill();
    Application.Exit();
    

rajan
02 сен. 2012, в 07:08

Поделиться

Это случилось со мной на VS 2010 и Win 7..
Случай:

  • Я не могу перестроить с помощью диспетчера конфигурации Debug, но я могу восстановить его с помощью диспетчера конфигурации Release

Изображение 121428

Что я пробовал:

  • Проверьте мой тип учетной записи на панели управления — учетная запись пользователя → Моя учетная запись является администратором

Изображение 121429

  • Установить папку bin не только для чтения

Изображение 121430

  • Добавить безопасность в папку bin для всех

Изображение 121431

  • остановить сервер iis

Изображение 121432

  • Остановите антивирус, проверьте запутанную запущенную программу с помощью диспетчера задач и ProcessExplorer

  • запустить VS как администратор

Если все это еще не работает.

Затем, последний способ попробовать:

  • закрыть решение
  • закрыть визуальную студию
  • start — shutdown
  • нажмите кнопку питания, чтобы включить компьютер.
  • войдите в свою учетную запись, у которой есть права администратора при типе пользователя.
  • повторно открыть решение
  • перестраивать
  • так работает. Все люди называют это как Reset Компьютер

Khaneddy2013
13 фев. 2015, в 06:18

Поделиться

  • Закрыть проект
  • Удалить папку bin

Я нахожу работу,:)

Novpiar Effendi
11 июнь 2016, в 17:59

Поделиться

Я обнаружил, что окончание всех задач msbuild.exe(в диспетчере задач) устранило проблему с VS2012.

mizzle
10 июль 2014, в 18:20

Поделиться

У меня была такая же проблема, после того, как вы прочли ваши ответы, отправились в Task Manager и искали app.exe, потому что я считаю, что, возможно, он не закрывается.
И нашел его, выберите его и решите END TASK.my проблему.

Hamid Talebi
21 март 2014, в 09:08

Поделиться

Прежде чем перестраивать решение, очистить проект, остановите IIS и откройте свойство папки «bin > . Снимите флажок Атрибут только для чтения на вкладке общего доступа, затем перестройте.

Kadir Can
04 нояб. 2013, в 15:31

Поделиться

Очень простое решение — открыть диспетчер задач (CTRL + ALT + DELETE), перейти на вкладку Процессы и выполнить поиск по имени процессов с вашим именем проекта, которые все еще запущены. Убейте все процессы и продолжайте!:)

Dina Bogdan
28 дек. 2017, в 20:39

Поделиться

Я боролся с этим с годами.
Наконец я загрузил LockHunter, чтобы узнать, кто заблокировал файл.
В моем случае это был MBAM.
Как только я добавил каталог проекта в список исключений MBAM, у меня больше не было этой проблемы.

tmighty
06 сен. 2017, в 11:03

Поделиться

Solution1:

  • Закройте проект.
  • Удалить папку bin.
  • Откройте проект.
  • Создайте проект.

Solution2:

Добавьте следующий код в событие предварительной сборки:

attrib -r $(OutDir)*..* /s

Этот код командной строки удалит атрибут ready-only из папки «bin». Теперь визуальная студия может легко удалять и копировать новые dll.

Rocky
12 май 2017, в 14:11

Поделиться

для меня это был антивирус. Просто добавьте проект визуальной студии или всю родительскую папку в список исключений антивируса, или вы также можете добавить расширение файла как исключение, и этот метод работал у меня в visual studio 2010/2012

Alex
01 июль 2015, в 02:32

Поделиться

Если эта ошибка возникла, вы можете перейти к следующему

  • Завершить задачу msbuild.exe
  • Завершить задачу explorer.exe
  • Запустите задачу explorer.exe снова

zawhtut
16 июнь 2015, в 07:47

Поделиться

Не прямой ответ на ваш вопрос.

Ниже приведен один сценарий, когда это возможно —

Если ваше приложение находится в процессе отладки — скажем, с помощью отладки «Прикрепить к процессу», эта ошибка может появиться

Lijo
16 апр. 2014, в 14:32

Поделиться

Ну, у меня такая же проблема, мой способ исправить это — остановить и отключить службу «опыт приложения» в Windows.

Kataku
03 фев. 2014, в 17:10

Поделиться

Я решил это, убив XDesProc, у которого был дескриптор DLL, который он не смог удалить.

Charlie
15 авг. 2013, в 17:30

Поделиться

Это будет звучать безумно, когда я когда-либо создам проект, будет отображаться ошибка, и антивирус avast покажет его как вредоносную попытку, и проект не запускается. Просто просто отключите мой антивирус и снова создайте мое решение. Создан файл EXE и успешно выполнен проект.

Или вы можете попробовать это

Ошибка сборки Visual Studio: невозможно скопировать exe файл из objdebug в bindebug

coolprarun
17 июнь 2013, в 12:39

Поделиться

Мы недавно испытали это на проекте WinPhone 8, в обновлении версии VS 2012 года.

Необъяснимо, причиной послужил тип Tuple. Удалив код, который использовал кортеж, проблема исчезла. Добавьте код обратно к проблеме.

Seamus
05 июнь 2013, в 14:29

Поделиться

Запустите Visual Studio как Administrator

Alexander Trofimov
18 апр. 2013, в 10:17

Поделиться

Ещё вопросы

  • 1Как очистить innerHTML от пролетов
  • 0Нагрузка на низ div не работает должным образом
  • 0Проблемы с сервером WAMP после установки OSGeo4W
  • 0Поиск и удаление в двойном связанном списке
  • 0Относительно ограничений MySQL
  • 0изменение ключа не запускается в файле js
  • 0Дочерний div рядом с родительским div, внизу
  • 0JQuery AJAX, возвращающий отправку страницы HTML
  • 1Как найти все цветные фигуры в изображении открытого CV Python
  • 1Оценка в моем приложении викторины JavaScript не хранится должным образом. Что не так с синтаксисом?
  • 0Получить переменную, потерянную в действии формы при отправке
  • 1Python Open CV оверлейное изображение на контуре большого изображения
  • 1Использование единого входного файла для реакции собственного приложения
  • 1App Engine gcloud: Не удается найти файлы Python в домашнем каталоге, но они работают?
  • 0Конфигурация NGINX: угловой SPA в корне и Slim REST API в подпапке
  • 0Mysql5.5 миграция в RDS / Аврора
  • 1Перемещение мыши Java mouseListener не работает
  • 0Можно ли получить доступ / изменить переменную области действия директивы из родительского контроллера
  • 0Нужен предварительный поиск в phonegap + jQuery?
  • 0Отмените выделение выбранной области карты изображения при наведении на карту
  • 0Как исправить неизвестный столбец MySQL Query Alias? 2018
  • 1Включить отключенный Spinner в Android
  • 0Как читать IP-адреса из файла .txt, используя preg_match в php
  • 0Найдите символ в заданной позиции в строке
  • 1MVC 5 Не удается неявно преобразовать тип ‘System.Linq.IQueryable в bool?
  • 1установка границ или экстентов составленных графиков в HoloViews
  • 0Найти текст внутри тега JavaScript с помощью PHP Simple HTML DOM Parser
  • 1ActiveMQ ограничение скорости внешнего сервиса
  • 1Как получить данные из списка массивов, используя строку
  • 0полоски зебры css для элемента динамического списка
  • 1Как использовать лямбду, чтобы применить стиль к Pandas DataFrame
  • 1Используйте PreferenceActivity и сохраняйте настройки в ContentProvider, как?
  • 1Веб-сервер Airflow выдает ошибку cron для пакетов с None в качестве интервала расписания
  • 1неправильные цвета matplotlib в диаграмме разброса сгруппированных данных
  • 1Ошибка Seaborn FacetGrid
  • 0Смущен (char *) приведением
  • 1Умножение на Python ijk, почему мы используем следующую запись присваивания или строку кода?
  • 1добавление отметок в d3
  • 0Массив удалить родительские массивы после декодирования json
  • 0Значение не в состоянии перейти с одной страницы на другую
  • 0Как сделать динамическую вставку SQL через xhr?
  • 0Как получить список изображений для удаления из одного запроса MYSQL
  • 0Angular.js, добавить строку к имени переменной?
  • 1Рисуем картинку в андроид
  • 0Перегрузка перегруженного метода: есть ли упрощение?
  • 0MEAN.js — Как перенаправить после функции Push
  • 0Как передать данные контроллера для просмотра в codeigniter
  • 0Как добавить CSS Transition для перемещения кнопок
  • 0C ++ Tron Player Lightcycle двигаться в одном направлении
  • 1Панды заменяют нан в зависимости от типа
  • Remove From My Forums
  • Question

  • I get the following error when I try to run my program.

     Error 1 Unable to copy file «objDebugHomeInventory.exe» to «binDebugHomeInventory.exe». The process cannot access the file ‘binDebugHomeInventory.exe’ because it is being used by another process. HomeInventory

Answers

  • OK, I’ve found out how to sort it out. I ran a program which figured out which application had the file locked, and it turned out to be devenv.exe, i.e. Visual Studio itself. A bit more searching and I found a fix.

    Create a pre-build action in your project by going to project properties (right-click on the project in the solution explorer, and select the Properties option), select the Build Events tab. Add this code:

    if exist «$(TargetPath).locked» del «$(TargetPath).locked»
    if not exist «$(TargetPath).locked» move «$(TargetPath)» «$(TargetPath).locked»

    This copies the file to a different name, and allows the build to continue successfully.

    Hope that helps anyone else who’s got this problem.

    Matthew

Понравилась статья? Поделить с друзьями:
  • Не удалось скачать установочные файлы visual studio 2017 windows 7
  • Не удалось получить доступ к программе установки windows 1с
  • Не удалось скачать windows 10 проверьте параметры сети
  • Не удалось получить доступ к windows installer для windows 7
  • Не удалось скачать windows 10 код ошибки 0x80190001