Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Visual-Studio
Alright, I've given up on everything. I am working on multiple applications. I can't seem to find the proper way to get this working. No matter WHAT I do, I get access denied errors. I've switched user accounts on Windows 7, I've reset permissions, etc.
 
Sometimes the project will compile and run fine. I'll edit some code, and hit F5 and it'll say "Unable to copy file to file" etc. I'll delete the file and sometimes it'll work. But it's getting worse - after I delete the file and I hit "F5" it'll show a quick loading cursor then nothing happens. The project doesn't even attempt to start. If I wait 5 minutes and hit F5, it'll start right up no issues.
Error	2	Unable to copy file "obj\x86\Debug\project.exe" to "bin\Debug\project.exe". Access to the path 'bin\Debug\project.exe' is denied.
 
Checking the task manager, the application isn't stuck open. Nothing is excessively stealing RAM or CPU. The app open and closes fine.
Error	1	Unable to copy file "obj\x86\Debug\project.exe" to "bin\Debug\project.exe". The process cannot access the file 'bin\Debug\project.exe' because it is being used by another process.	
ANY kinds of ideas? I'm seriously giving up on it! It's killed me all night and slowed me down. My code is pointing to a blank form. I've removed ALL code. Same issue. This is .NET framework 4.0 x86.
 
When I delete the file, and hit F5, that's when I get the error. Sometimes it won't open. It's random. I'm using a fresh version of VS 2010 with latest updates SP1 (ultimate)
 
The weird thing is when it gets access denied, Windows denies my access 100%! I can't run it (gives a error, sorry didn't save it) and I can't delete the file. When I right click and go to security, it says access is denied. I've been getting weird security positions on my Windows 7 install lately - could this be related?
Posted 7-Dec-11 0:25am
Edited 7-Dec-11 16:01pm
v4
Comments
SAKryukov at 7-Dec-11 5:32am
   
Can you possible reduce the code to the size suitable to post in your question (use "Improve question") so it would still show the problem?
--SA
Thomas Mack at 7-Dec-11 11:02am
   
The code is a basic form layout that comes default, I've removed the little bit of code. I started the project yesterday.
Albert Holguin at 7-Dec-11 13:50pm
   
Something has to be tying up the file (maybe some IDE component that's failing)... there's a way to see what process has the file locked, can't remember off the top of my head, but try searching google for a way to do that. Then next time it locks up, see what's locking up access to the file.
Thomas Mack at 7-Dec-11 14:01pm
   
This is a good idea.. Was it called unlocker? I have that installed, but it says it's not locked =X
Thomas Mack at 7-Dec-11 14:33pm
   
OK if I close and reopen Visual Studio it says the file is still locked.
Albert Holguin at 7-Dec-11 14:57pm
   
Well, Visual Studio is the IDE, it's made up of different applications... if you close the IDE (Studio) a rogue process (let's say the debugger) may still be hanging.
Thomas Mack at 7-Dec-11 14:35pm
   
[Window Title]
S:\project\bin\Debug\project.exe
 
[Content]
Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.
 
[OK]
 
OK - could this have anything to do with SlimDX or LUA? I'm running everything in X86 .NET 4.0
Albert Holguin at 7-Dec-11 14:58pm
   
You are running Studio with admin privileges right?
Thomas Mack at 7-Dec-11 16:59pm
   
Yes, of course. I have everything disabled (UAC) so everything for the most part runs as admin for me. I think it's LUA being stuck open. Tonight I am going to run each project separately and figure out what's going on, it's completely random.
Albert Holguin at 8-Dec-11 9:24am
   
Good luck, this sounds like a headache... is it only happening with this project or is it also occurring with other projects?
Thomas Mack at 8-Dec-11 12:04pm
   
It is. I got called into work so I haven't really messed it. I don't do much windows development mostly ASP.NET and this issue is non-existent but that all runs off my local IIS server... I'll mess with it when I get home today and if I find a solution I'll post it. I really think the LuaInterface DLL is hanging up. I'm going to remove the script execution and see if it continues to hang up. The DLL I found on a blog that was recompiled for .NET 4.0, so it might be that. The way it's acting seems like something is acting up. I have multiple projects:
 
MainProject.dll
Project1.exe
Project2.exe
 
Both project 1 and project 2 do the same thing, and they both are compiled with the DLL - but I've done this plenty of times and never had a issue.
 
And to think of it, NO, It doesn't happen on other projects. but what's confusing me is I've been having Windows Permission errors lately on my Windows 7. My OS is setup to have no security (UAC) features, so everything by default is ran as Administrator.. When I right click on the exe it says "Access is denied" I can't access ANYTHING on the EXE. Can't even change the read only properties or anything. When I right click, my computer shows a hour glass for about 30 seconds... Everything it's doing is so weird! After about 3 minutes, I can compile it with no problem. So it's giving me the feeling that SOMETHING is hanging and the only thing it can be is Lua...
Albert Holguin at 7-Dec-11 9:17am
   
I haven't used VS2010 on Win7, but I know VS2008 had a lot of bugs running on Win7 that were odd before MS issued SP1 for VS2008. I'd imagine they wouldn't have those same issues with VS2010, but maybe look through the MSDN websites to see if anyone is having the same issues in case they've issued a hotfix.
Eduard Lu at 7-Dec-11 21:02pm
   
EDIT: added "pre" tag
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Check your task manager and see if the project.exe or project.vhost.exe is running.
 
If this is the case then your application is not closing properly.
  Permalink  
Comments
Thomas Mack at 7-Dec-11 5:30am
   
I've already done that, they are not running. When you run VS in debug mode if you goto "Stop Debug" the application is forced closed no matter what. No rogue app is running to cause this issue. That's why I'm confused.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

I'm not 100% sure what/why, but I created a whole new project, added coded manually, same thing. Removed references nothing. I set the start up project as the EXE project (rather then the solution->selecting the startup project there) and it seems to work.
 
So it's working now.. no clue why, must be a bug? Maybe it wasn't compiling and linking the DLL project, not sure.
  Permalink  
v2
Comments
Albert Holguin at 9-Dec-11 14:40pm
   
Interesting... I'd have to look at your project to see if there was a dependency problem. Well, at least you're up and running again. Cheers!
kero6417 at 10-Apr-12 18:45pm
   
I met exactly the same situation as you described. I tried all means, hours of googling to get rid of that; but it still occasionally showing. I agree with you that it should be something related with the windows 7 security issue. as what you mentioned when access the Property/Security Tab. As you said, "I've been getting weird security positions on my Windows 7 install lately ", could you list what kind of security position you have got? I really want to find the root reason and close this issue.
 
you can also reach me at pwang.ms@gmail.com rather than response here.
 
Thank you very much.
 
Peng.
Thomas Mack at 10-Apr-12 21:44pm
   
I never did figure out. I meant to say permission, not position as well. I've been getting a lot of Access Denied errors on my Win7 box. I got fed up with the issues, that I formatted my PC. Once I formatted and reinstalled Windows 7, the issue went away completely. I don't know what caused it. Somewhere, somehow, Windows 7 messed up the permissions. Perhaps a undetected rogue application did it, perhaps it's a glitch with Windows 7 that over time the permissions get messed up.
 
So somewhere I had an issue, not sure where. But other then that, this issue is technically resolved but the actual fix is unknown. The only known fix right now is to format and reinstall Windows 7.
kero6417 at 11-Apr-12 12:22pm
   
Yes, I think i have to agree with what you said. Finally, I have to turn to our network team for help to reinstall windows 7.
 
Thank you for your reply.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 9

Finally I know how to solve this problem. After 2 days google-ing..
 
Turn on windows service :- Application experience
 

Computer (right-click) -> manage -> Service & Application -> service -> Enable Application experience
 
Works for me.. hope it helps
  Permalink  
Comments
cubrman at 29-Apr-13 15:10pm
   
Like, TOTALLY helped me)
harley7988 at 9-Oct-13 14:07pm
   
This problem recently popped up for me again after I solved it years ago. Unfortunately, I forgot how I solved it. Seeing this solution, I remember this was the answer then and now. Not sure why, this service shouldn't have anything to do with when my files are unlocked, but hey. Thanks for the reminder!!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

No real solution was found. I ended up reinstalling Windows 7. I was getting access denied errors with several different things, not just Visual studio. VS2010 was the most affected, though. The only solution known is to reinstall Windows.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

I was getting 'Unable to start program "http://localhost:51351/". Access is denied.'
This only happened with F5 (Start Debugging). A browser window would open and hang, and had to use Task Manager to kill it.
However, Ctrl-F5 (Start Without Debugging) worked ok.
 
We originally tried running VS with full admin privileges and that did not help.
 
We think these 3 things fixed it:
1) moved the project from a network drive to c: drive.
2) gave me full admin rights to the whole visual studio folder system.
3) changed setting in web.config:
in the system.web section, add: compilation debug="true"
 
HTH
Mike
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 10

Finally I know how to solve this problem. After 2 days googling..
 
Turn on windows service :- Application experience
 

Computer (right-click) -> manage -> Service & Application -> service -> Enable Application experience
 
Works for me.. hope it helps
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 11

maybe is you antivirus or firewall that block the new executable.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 12

There are obviously various things that can "Fix" this Bug.
 
What sometimes works for me, is closing the solution, then reopening it and rebuilding...
 
Not sure if it will work all the time.
 
Thanks
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 13

Hi All! It's my antivirus "avast" is the problem! So go and give permission to needed path and voila!!!!
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 
Right-click on the solution then choose 'Clean Solution'. Then right-click on the solution again, then choose 'Rebuid Solution'. Then 'Build Solution'.
 
Let me know if this doesn't work Smile | :)
 
Regards,
Eduard
  Permalink  
Comments
Thomas Mack at 8-Dec-11 0:27am
   
I wish it was that easy :'( I've done this tons of times. It has to be the LuaInterface being stuck open, that's the only thing I can think of.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

Hi,
 
Check that you have all the permission to make the appropriate modifications.
 
And alos check whether the folder / file / solution is marked as ReadOnly. If maked readonly please unchek and rebuild the solution.
  Permalink  
Comments
naelnael at 27-Sep-13 17:36pm
   
can you illustrate your comment ?
what to click ?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

I found that the way to fix the issue is to go to the folder containing the exe that your program is attempting to replace, right click on it and under the general tab uncheck the read only property.
 
This worked for my program. I do not know why or how the folder became read only, i only know how to undo it.
 
Hope this helps(>_<)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 8

This issue has been RESOLVED by REINSTALLING WINDOWS.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 OriginalGriff 120
3 PIEBALDconsult 110
4 Zoltán Zörgő 99
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 16 Apr 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100