Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
when I try to debugg my C# .NET application it sometimes happens that VS Community 2022 cannot store the result (WPF_CFG.exe file) of a new compilation. WPF_CFG is the project name, it stands for WindowsPresentationFoundation_CineFileGeneration.
It seems, that not all processes are closed when a Debugg session has been terminated (with end debugg, of stop all) in order to start a new Debugg session.
The new compilation seems to be done, but the result cannot be stored because another process is still working, But the compilation seems to be error free. No other debugg instance is presented as running - no application window is open!

See the following message (sorry, is in German).
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5094,5): warning MSB3026: "D:\C#Prog\WPFProjekte\WPF_CFG\obj\Debug\net6.0-windows10.0.22000.0\apphost.exe" konnte nicht in "bin\Debug\net6.0-windows10.0.22000.0\WPF_CFG.exe" kopiert werden. Wiederholung 1 wird in 1000 ms gestartet. Der Prozess kann nicht auf die Datei "bin\Debug\net6.0-windows10.0.22000.0\WPF_CFG.exe" zugreifen, da sie von einem anderen Prozess verwendet wird. Die Datei wird durch "WPF_CFG (23092)" gesperrt.

How can I force that all running processes of the Debug session just has been terminated are also terminated and that not 10 attempts to store the .exe are made before compilation is ended erronous.
I have to shut down the system (after the 10 failing storing attemps) and restart it again, to continue debugging,

Any hint welcome.
Wolfgang

What I have tried:

I must shutdown the system or I have to find the still runnung process which is pretty difficult.
Posted
Updated 20-Jun-22 4:09am

This seems liek a common problem through various VS builds -

Options available looks like -
1. Clean solution and rebuild solution again.
2. Close VS, delete your bin and then object folders, re-run build again.
3. Roll back your windows 10 update versions to before 2004 also seems to work.

Hopes this help...
See here for more info
OR here for Windows 10 update version
 
Share this answer
 
v2
Quote:
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5094,5): warning MSB3026: "D:\C#Prog\WPFProjects\WPF_CFG\ obj\Debug\net6.0-windows10.0.22000.0\apphost.exe" could not be copied to "bin\Debug\net6.0-windows10.0.22000.0\WPF_CFG.exe". Retry 1 will start in 1000 ms. The process cannot access the file "bin\Debug\net6.0-windows10.0.22000.0\WPF_CFG.exe" because it is being used by another process. The file is locked by "WPF_CFG (23092)".

It may be that you have an active process holding the file. Check current processes in Task Manager.
 
Share this answer
 
Yes, following the past comments. I was having the same MSB3026 issue appear and tried changing the file permissions etc, nothing worked. Then I deleted the obj file and the bin file but it didn't work due to the file being opened elsewhere. Opened cmd in admin, used the tasklist command and then the taskkill/pid for the process that was using the app. The processes was the same name as the app. For ex my app is called americaapp and the task was americaapp.exe. Then reopen vs then clean and rebuild the app. I hope this helps, even for future readers who haven't solved it yet. I'm sorry if some of my English is broken, it still makes sense so it doesn't matter. English is only my first and native language so please excuse me.
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900