"Error Unable to copy file "obj\Debug\WindowsService1.pdb" to "bin\Debug\WindowsService1.pdb". The process cannot access the file 'bin\Debug\WindowsService1.pdb' because it is being used by another process. WindowsService1"
for this error i add the one solution in pre-build:
if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"
but again getting the same error
thanks in advance.

Amit GuptaRank #190 · 12.8K reputationPosted Aug 8, 2019, 10:24 PM EDT
Sheetal Garg153 reputationPosted Aug 9, 2019, 3:38 AM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Aug 9, 2019, 3:42 AM EDT
Sheetal Garg153 reputationPosted Aug 9, 2019, 3:45 AM EDT
Vishal PatelRank #3,290 · 437 reputationPosted Aug 9, 2019, 3:50 AM EDT
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