Error 1 Unable to copy file when compiling
Whe i try to compile my project, i get this error
Error 1 Unable to copy file "obj\Debug\oneForce.pdb" to "bin\Debug\oneForce.pdb". Access to the path 'obj\Debug\oneForce.pdb' is denied. oneForce
Can an开发者_如何学Goybody help me on how to rectify it?
Something else probably has the obj\Debug\oneForce.pdb file open. Do you have the project open in multiple copies of Visual Studio?
Otherwise find out what has the file open. See this superuser question for how to do that.
Visual Studio is trying to modify the automatically-generated PDB file (containing debugging information) located in your project's Debug
folder, but something is preventing it from doing so.
Make sure that you have full write privileges to the folder where your project is saved, and that the PDB file is not in use by a debugger (such as another instance of Visual Studio).
The error message tells you the path relative to your project/solution directory that the file is located in; this is where you should check to ensure that you have read/write access:
<SolutionDir>\bin\Debug\oneForce.pdb
And you can use an application like Sysinternals' Process Explorer to check and see what other applications might have that file open.
Finally, if all else fails, try closing Visual Studio and restarting it. That usually fixes any issues where file handles remain open when they should have been closed.
Make sure that the application you're compiling isn't running when you're building the project or the DLL being built (if it's a DLL) isn't referenced by any application that is running.
You can use Process Explorer to search for your application and possibly kill the process that is using it if closing it normally didn't work.
Thanks for all who contributed
in the obj
folder of the project, i renamed the debug folder, the reason being that i tried to deleted it, but windows won't let me, saying the folder is not empty. So i suspect file curruption and simply renamed the folder.
that solved the problem
thanks all.
Looks like your app is used by another process. Make sure it is not running. Open task manager and check if it not there.
Restarting VS or machine should help, but you need to figure out what is holding your pdb. Could be performance analyzer, or DotTrace.
You can use process explorer (from sysinternals) to discover the process (or application) that is locking the pdb file.
精彩评论