25

The title pretty much says it all. I'm using a RFT, VS addin that allows me to edit a proprietary data file with a GUI. The problem is that this file doesn't show up in VS and when I start editing it via the GUI, VS doesn't check it out automatically (probably a bug of the VS addin). So, I've to check it out manually before editing it, otherwise the addin will crash when trying to save the file (because it is read-only), and sometimes will also corrupt the local working copy of this project. Everything would be much easier if TFS didn't mark the file not checked out as read only. Do you know if there is a way to instruct TFS to keep all the files as not read-only?

CodeClimber
  • 4,109
  • 4
  • 32
  • 44
  • 3
    I feel your pain..I can't stand this behavior either -- MS Word is a terrible offender too, even if you go back and check the file out so that it becomes writable you *still* have to save with a different filename and then go fool around renaming files. – Luke Aug 06 '09 at 21:15
  • There's a registry key at `HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\SourceControl` called `WriteableOnGet` but I can't seem to get it to do anything – Maslow May 13 '11 at 15:36

4 Answers4

10

I have the same issues with TFS. Our project has a few small SQL Server database files that we have chosen to put under source control. We handle the read only issue by adding these to the post build statement on the project build. I suppose we could have done this pre-build as well.

attrib $(TargetDir)*.mdf -r

attrib $(TargetDir)*.ldf -r

Mike
  • 101
  • 1
  • 2
10

No. You can exclude it from source control, but that's probably not want you want.

NotMe
  • 87,343
  • 27
  • 171
  • 245
  • 2
    I HATE this TFS mechanic, especially when I need to update files outside VS. This is NOT the case with SVN. You just edit at will and it doesn't bother you with Meta-Work of checking out. It knows that the fact you made modifications, lists it in the files that can be committed. –  Mar 19 '13 at 02:35
2

It has been a while, but - I think this link is actually the answer to that.

When you do a check out, what you are actually doing is saying “TFS, I would like to edit the version of the file that I have already downloaded, is that ok?” TFS then looks at that version, and tells you if you can edit it or not (based on your security permissions at that point in time and if anyone else has placed a lock on the file). If you can edit the file, the TFS marks the file as read/write on your local machine and allows you to proceed.

I.E: When I r.clicked the project and selected "Check out and edit", the r/o flag was automatically removed, and I could compile (with both pre/post events) and then "check in" again.

SimSimY
  • 3,616
  • 2
  • 30
  • 35
  • +1, I had the same issue with trying to edit version controlled scripts in SQL Server Management Studio. "Check out and edit" in VS Source Control Explorer made the scripts read/write, and I can edit in Mgmt Studio. I was used to svn, this behavior threw me for a loop – Matt Stephenson Dec 07 '11 at 16:41
1

Well you can get latest to a samba share, which eats the readonly bit.

Joshua
  • 40,822
  • 8
  • 72
  • 132