开发者

I need help with this error please: Could not write to output file...file is being used by another process.

开发者 https://www.devze.com 2023-03-23 09:54 出处:网络
Could not write to output file \'C:\\Users...\\Documents\\Visual Studio 2010\\Projects\\Application 2\\Application 2\\obj\\x86\\Debug\\Application 2.exe\' -- \'The process cannot access the file becau

Could not write to output file 'C:\Users...\Documents\Visual Studio 2010\Projects\Application 2\Application 2\obj\x86\Debug\Application 2.exe' -- 'The process cannot access the file because it is being used by another process.'

I have been getting this error since last weekend. I have searched it on the web and found a few solutions w开发者_开发百科hich I have tried to no avail.

  • I have closed all my design views and then tried running.
  • I have closed ALL windows and then tried running.
  • I have unloaded the project and reloaded it.
  • I have deleted the 'obj'-folder in my 'application 2'-folder.
  • I have closed Visual Studio and reopened my project via the start page as well as via the solution exe.
  • I have edited the pre-build event command line with something that supposedly unlocks the file and then tries building it.
  • I have downloaded 'ProcessExplorer' to try and identify a process that might be locking this file and ending it. -I have even done a total system restore to 3 weeks ago in-case there was an issue.

Some of these solutions worked the first time I did it, but thereafter it doesn't.

The only thing that seems to be working consistently is if I restart my computer. It then builds one to four times successfully, but then starts giving me this error.

I haven't done anything drastically different in my code that might affect my project in such a way to suddenly give me this error. I am using C# and doing a winforms application connecting to a postgresql database.

Just a note: It did this before, but then I just click NO to run previous build and rerun it, then it works. It now is a permanent problem.

I hope someone would be able to help me with a fix for this.

Thanks.


My guess is that your virus scanner is getting in the way. Try to disable real time scanning and if that helps.


I've encountered similar problems when using third-party addons that are supposed to analyze code and things like that.

There must be something attaching to your program that does not get properly closed/disposed/etc. when the program ends.

I would look around and see if you can find anything that may be using your executable. Then you can try to turn this off, or use the task manager to kill the process.


In the "xxxx.csproj" file,search the file name 'Application 2.exe'

If you see the following XML

<Reference Include="Application 2">
  <HintPath>obj\Debug\Application 2.exe</HintPath>
</Reference>

remove!!~~~

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号