Error VSP1737: File could not be opened due to sharing violation

865 Views Asked by At

I am getting below error in the Visual Studio 2013 Ultimate when running performance and diagnostics session with Team Foundation Server (TFS). Below are the steps to reproduce:

  1. Get latest from Team Foundation Server.
  2. Create new Performance Session of "CPU Sampling" method.
  3. Launch the newly created Performance Session.
  4. After exiting the session by closing internet explorer or clicking on "Stop Profiling".

Then I would get below error in the Output Window.

Preparing web server for profiling.
Profiling started.
Launching web server with profiling.
Launching profilable project.
Profiling process ID 9460 (iisexpress).
Profiling process ID 7008 (iexplore).
Process ID 7008 has exited.
Process ID 9460 has exited.
Error VSP1737: File could not be opened due to sharing violation: C:\Users\%hiddenuserprofile%\Documents\Projects\%HiddenPathWithFilename%.vsp
PRF0025: No data was collected.
Profiling complete.

In order to get rid of this error, I would have to clear the read-only attribute of my solution folder which TFS has set. If I clear the read-only attribute then the TFS cannot detect changes in my local workspace with the TFS server. Then I would have to manually check for changes with compare option in TFS and then merge.

Why does this error shows up? Am I doing it the right way?

1

There are 1 best solutions below

2
On

This error occurs because you have added files to source control that should not be in there. Therefore it is downloaded from TFS and marked as read only.

You should use a .tfignore file. You will have to manually remove all of the files that have already been added. You should not have any /bin/* or /obj/* files for a start...

Then check for *.dll and other binaries, including *.vsp files and remove them from source control.

There are two types of binaries:

  1. References - these should be done using Nuget and never included in source control or added manually.
  2. output/generated - No generated files should be added to source control.