windows 7 - Prevent a process from preventing a file from being written by another process
2014-07
My scenario: I just updated to Visual Studio 2013 update 2. The process VCPkgSrv.exe (Microsoft (R) Visual C++ Package Server)
who — from what I have gathered from the internet — is associated with intellisense and autocomplete, malfunctions (I use a CTP version of the compiler who is ahead of intellisense in features implemented) and keeps some headers from being accessed, a process needed very often in my workflow:
I have two C++ solution (so 2 Visual Studio processes devenv.exe
)
devenv.exe 1
- compiles a static library. A custom post–build event copies the headers from the project folder to therelease
folder. This fails (more details bellow).devend.exe 2
- is a solution for testing the library. So it includes the headers from therelease
folder. TheVCPkgSrv.exe
started by this process keeps some headers in the release folder from being written bydevenv.exe 1
.
Every time I compile, I have to manually end the process VCPkgSrv.exe
started by devend.exe 2
(it automatically restarts) which is very unproductive and stressful.
Error details:
The custom event is a script which uses xcopy
. When reaching the first file it cannot copy it outputs: Sharing violation
. When trying to delete said file from the release
folder manually the error The action cannot be completed because the file is opened in Microsoft (R) Visual C++ Package Server
pops out. Process Explorer
shows that handles to these files are opened by VCPkgSrv.exe
– a child of devend.exe 2
.
Up until the update, the Microsoft (R) Visual C++ Package Server
crashed with don’t send error
so there wasn’t a problem. Now the process doesn’t crash, but keeps the file opened which is a problem (ironic, isn’t it?).
Is there a way to prevent the process from getting a handler to these files (keep in mind that the files get recreated at every compilation (xcopy
from bat
script)? Or better yet, to let him get a handle in share mode (if that is possible)?
One other drastic solution would be to prevent devend.exe 2
from starting VCPkgSrv.exe
altogether. Is this possible?
Can you think of another solution? Ultimately I will reinstall VS without the update, but I am hopping for a smart solution.
Possible Duplicate:
How do I delete a ‘locked’ file?
How can I find out which process is locking a file or folder in Windows?
For instance if you are trying to delete a folder and windows reports
"The action can't be completed because the folder is open in another program"
Several options:
Microsoft/SysInternals Process Explorer - Go to Find > Find Handle or DLL. In the "Handle or DLL substring:" text box, type the path to the file (e.g. "C:\path\to\file.txt") and click "Search". All processes which have an open handle to that file should be listed.
WhoLockMe - Explorer extension which adds a right-click menu option
Install SysInternals' Process Explorer, and search for the file using the Find... menu.