locked
Visual Studio 2010 Automatic Check Out Not Working on File Edit or Save RRS feed

  • Question

  • I have a solution of 4 projects under source control in a TFS server. I am using Visual Studio 2010 and have a workspace set up locally on my machine. Under Tools->Options->Source Control->Environment I have the Settings set to Team Foundation so all the check boxes are unchecked and under Checked-In Items I have Saving: set to "Check Out Automatically" and Editing: set to "Check Out Automatically". Allow checked-in items to be edited is also unchecked (though I tried this with it checked as well and it did not fix my problem).


    When I edit a file in Visual Studio 2010, it does not get checked out. So when I make some changes to any file and try to save, I get the message:

    The file X.cs cannot be saved because it is write-protected.

    You can either save the file in a different location or Microsoft Visual Studio can attempt to remove the write-protection and overwrite the file in its current location.

    I then have to select Overwrite. When I go to my source control, it doesn't recognize any change. It says I have the latest code and there is no pending change. I have to manually check-out the file before it realizes there is a change and then I can check it in.


    My colleague has another workspace in the same project and his works fine. If he edits a file, it immediately checks out the file and shows a pending change in his source control. We have the exact same version of VS2010 (10.0.30319.1). I went through his settings and they are identical to mine. I even deleted my workspace and tried to create another one and I still have this problem. Going through every file I want to change beforehand and checking it out manually is just ridiculous. How can I make the automatic check out work again?
    Tuesday, July 6, 2010 8:00 PM

All replies

  • Hello,

     

    Please go to Tool/options/ Enviroments / Document 

     

    Ensure that "Allow editing of read only ...." is unmarked.

     

    This should resolve this issue!

     

    Regards


    []'s Alexandre Campos
    Tuesday, July 6, 2010 8:12 PM
  • All this does is not give me the dialog:

    The file X.cs, which you attempted to edit, is read-only on disk. Would you like to make the file writeable or edit it anyway?

    With the options "Edit In-Memory", "Make Writable", "Cancel" and "Help"

     

    Selecting Make Writable will let me edit the file, but it still does not show up properly in my source control as a changed file even if I make changed. Nothing is listed in Pending Changes. Source control still tells me I have the latest file. It is still not checking out the file automatically. This doesn't fix the problem.

    Tuesday, July 6, 2010 8:19 PM
  • Interesting...

     

    Some questions:

     

    1- The solution is bounded to source control?

    2- How do you usually make a checkout checkin? via solution explorer or via source control?

    3 - In solution explorer you can see the icons of source control?

    4- Access the file/source control/change source control. Everithing is connected and valid?


    []'s Alexandre Campos
    Tuesday, July 6, 2010 8:48 PM
  • Hi Sagaraw,

    How is the issue now?


    Best regards,
    Ruiz
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com
    Wednesday, July 14, 2010 5:49 AM
    Moderator
  • Hey Sagaraw,

     

    I was experiencing this exact same issue. By any chance did you notice your solution "go offline" at any point? During my searching trying to resolve this issue, I came across your post here, and another one, here: http://social.msdn.microsoft.com/Forums/en/tfsgeneral/thread/075b878f-9d05-4819-a47b-780402a6bd02 that reminded me I had seen my solution "go offline" at one point.

    I went to File -> Source Control -> Go online, and now files are again being auto-checked out for editing again.

    Hopefully that is your issue, too.

    • Proposed as answer by Stephane D Wednesday, September 8, 2010 2:28 PM
    Friday, July 16, 2010 3:29 PM
  • I've seen this suggestion on multiple threads and discussions. And since my Internet connection drops occasionally, I do believe VSTS has gone offline now and then.

    Unfortunately, there's no Go online option in my Source Control menu, nor any Go Online button in my Source Control Explorer (as I saw in one discussion). Is there something I have to do to enable that option?

    I should add: automatic checkout was working just fine for my first month of VSTS use. Then our admins moved our server, and it stopped working (but that may have been coincidence, or may be because my connection went offline while they were moving). They had me try refreshing my workspace. That didn't help. Then they had me try refreshing my DNS with this commmand line:

    ipconfig /flushdns

    That seemed to fix the problem for a couple of days. Now it's back.


    UPDATE: I found a Go Online command in the context menu for the solution. Still nothing on the File -> Source Control menu. But the one on the Context Menu fixed my problem. Thanks!


    Martin L. Shoemaker
    Friday, July 23, 2010 10:53 PM
  • Just installed Team Studio 2010 and having the same 'not checking out automatically' problem.  confirmed the settings mentioned above.  Do not have an off-line problem.  But still the auto check out does not seem to function as expected. 

     

    As a work around it would be nice if the dialog: "Edit In-Memory", "Make Writable", "Cancel" and "Help"  added a "Check Out Now"  option.

    Thanks

    Friday, August 13, 2010 7:56 PM
  • Thanks, this solution worked for me.
    Friday, September 3, 2010 1:36 PM
  • Hello all,

     

    I found out the clean solution to it.

     

    Action:

    Just goto File->SouceControl->Change Source control. Select all projects and click bind, to bind them to TFS (source control).

     

    Result:

    The icons of lock and face(if checked-out) will start appearing next to files in solution explorer. This means now the files are bound to source control and they will honour your Source-Control options as given in Project->Options and Settings->source control.

     

    As for this particular problem, this will allow to checkout files automatically on edit.

     

     

    -Munish Goyal

    • Proposed as answer by Aditya Barman Thursday, December 22, 2011 12:56 AM
    Sunday, November 28, 2010 10:58 AM
  • I just had the same issue.  In my case, I found that when I had gotten the latest version of the source code from Source Control, the source files were writable (i.e., not read-only); so when I attempted to edit a file, the automatic checkout did not occur.  When I re-obtained the source code from Source Control (this time ensuring that the "make writable" option was unchecked), the automatic checkout resumed once the files were read-only.
    Josh
    Tuesday, November 30, 2010 3:42 PM
  • I had a similar problem and thanks to your comment finaly solved, thanks for advance.

    Point was that I was working on some kind of off-line mode, come to switch to online all work fine.

     

    Friday, December 17, 2010 6:45 AM
  • I have a similar issue with "checkout automatically" for files that are added to a solution/project. I binded the solution and the files associated with the solution/project are still not automatically checkedout when I tried to change and save the file. It pops the dialog "Edit of Ready-Only File" with the error message:

    The file actl.rh, which you attempted to edit, is read-only on disk. Would you like to make the file writeable or edit it anyway?

    ..... And the options are "Edit In-Memory", "Make Writeable", "Cancel", or "Help".

    As soon as I exclude a file from the project, "checkout automatically" works again when I change & save the file.  

    My settings for "check out automatically" are:

    Tools -> Option -> Source Control -> Environment -> Checked-in items

    • saving: Check out automatically
    • Editing: Check out automatically

    Could it be a problem with solution/project settings?

     

    ps. I am using VS2010 on VISTA.

    Thanks,

    Luong

    Friday, December 17, 2010 4:26 PM
  • I found the problem. I binded the solution but I did not bind the projects...

    "checkout automatically" works now after I bind the projects.

     

    Thanks,

    Luong

    Friday, December 17, 2010 6:14 PM
  • I just had the same issue.  In my case, I found that when I had gotten the latest version of the source code from Source Control, the source files were writable (i.e., not read-only); so when I attempted to edit a file, the automatic checkout did not occur.  When I re-obtained the source code from Source Control (this time ensuring that the "make writable" option was unchecked), the automatic checkout resumed once the files were read-only.
    Josh

    In my case this comment really helped.  I am using VS2010 with Visual Source Safe.  I am sure that I haven’t got latest with the “Make Writeable” flag checked.  But for some reason a lot of my files are checked IN but NOT read-only.  So if I edit them they don’t check out correctly.  

    I am going to set the read-only flag for all my checked in files and hopefully no more problems.  IMHO, I think relying on the read-only flag to trigger a check out is a bit weak.  This is so important I think another method should be used.  But I guess I am not a source control guru - just a long time user...

    Friday, February 11, 2011 12:25 AM
  • Hello all,

     

    I found out the clean solution to it.

     

    Action:

     

    Just goto File->SouceControl->Change Source control. Select all projects and click bind, to bind them to TFS (source control).

     

    Result:

    The icons of lock and face(if checked-out) will start appearing next to files in solution explorer. This means now the files are bound to source control and they will honour your Source-Control options as given in Project->Options and Settings->source control.

     

    As for this particular problem, this will allow to checkout files automatically on edit.

     

     

     

    -Munish Goyal


    This worked for me.

    I had set up TFS and checked in the solution but because it was not bound I was getting the error message above. Once I bound it then the silent check out worked as expected.

     

    Monday, June 6, 2011 2:00 PM
  • Worked!!

    This was driving me nuts.  Auto-checkout wasn't working, so I'd been manually getting files and checking them out and running TF gets.  Not exactly behavior that you would expect to work when you are "offline".  Nonetheless, we DID have a network outage a week ago, so this explains it.

    I wish it was easier to tell what state TFS was in, but I guess now that I know where to look...

     

    Wednesday, June 8, 2011 2:14 PM
  • Thanks Jordan, that fixed my problem.

     

    Thanks

    Sai

    Monday, August 8, 2011 2:11 PM
  • This worked for me. Thanks
    Friday, August 12, 2011 8:41 PM
  • The solution that worked for me was: Tools -> Options -> Source Control -> Environment

    Under Checked-in items ensure the following:

    • Saving - Check out automatically
    • Editing - Check out automatically
    • Allow checked-in items to be editied is checked.

    Hope this helps someone else!

    Thursday, January 5, 2012 4:44 PM
  • Hello,

    I tried to do this for my solution, and any of the projects under my solution (which are all in TFS source control), but I get the following prompt when trying to Change Source  Control:

    Most of my files are read-only right now b/c I don't have them checked out of TFS. Do I need to check EVERYTHING in first using the Source Control Explorer before trying to change Source Control?

    I'm not too sure what the best option for this prompt is. I don't want to loose any local work (which is why I asked if it's a good idea to check everything in first before trying to change source control), but I do want to be able to check files in and out directly from the VS2010 ide and stop having to use Source Control Explorer...

    Thanks,

    Mike

     

    Wednesday, January 25, 2012 6:53 PM
  • Hey Sagaraw,

     

    I was experiencing this exact same issue. By any chance did you notice your solution "go offline" at any point? During my searching trying to resolve this issue, I came across your post here, and another one, here: http://social.msdn.microsoft.com/Forums/en/tfsgeneral/thread/075b878f-9d05-4819-a47b-780402a6bd02 that reminded me I had seen my solution "go offline" at one point.

    I went to File -> Source Control -> Go online, and now files are again being auto-checked out for editing again.

    Hopefully that is your issue, too.

    Thank you! Your solution fixed my issue.  

    • Proposed as answer by Jufflar Wednesday, February 12, 2014 7:58 PM
    • Unproposed as answer by Jufflar Wednesday, February 12, 2014 7:59 PM
    Thursday, March 15, 2012 2:18 PM
  • Hi,

    1. Start TFS in IIS

    2. In source control Right Click on file select Go Online option.

    Then you can able to checkin, checkout files.

    Thanks,

    Rajesh.

    Wednesday, March 21, 2012 8:27 AM
  • I've had success with changing my settings in VS2010:

    Tools -> Options -> Source Control -> Integration Options -> When Check Out is Required, on Edit -> Automatically Check Out

    This allows me to bypass that pesky Check Out dialog whenever I want to edit a file.

    Good luck!

    http://janianderson.com


    Wednesday, April 11, 2012 3:50 PM
  • This is perfect solution..:) Thanks,

    Tuesday, June 19, 2012 4:06 PM
  • This solved it for me. Thanks!!
    Wednesday, August 8, 2012 2:18 PM
  • I found out the clean solution to it.

    Action:

    Just goto File->SouceControl->Change Source control. Select all projects and click bind, to bind them to TFS (source control).

    ---

    thanks! That worked.  That was a big help.

    Monday, September 17, 2012 7:39 PM
  • Same issue, and this fixed it.

    Binding was missing, and VS thinks it is online as well.

    But whats strange is if u go offline, and go online manually on the solution, the changes show up. That is what I don't get.

    Anyway glad that binding helped resolve the issue. Thanks Munish!

    Thursday, March 28, 2013 3:19 PM
  • Thank you!  This was exactly my problem.
    Tuesday, October 8, 2013 1:40 PM
  • Yes!  Thank you!
    Monday, October 28, 2013 11:06 PM
  • I was having a similar issue.  I didn't have the options to "Go Online" or "Change Source Control".

    To fix the issue, go to Tools -> Options -> Source Control -> Environment -> Check "Display silent check out command in menus".

    From there, I was able to correct the binding by going to File -> Source Control -> Change Source Control and bind my project/solution files.

    Hope this helps.

    Wednesday, April 16, 2014 2:42 PM
  • Hey Sagaraw,

     

    I was experiencing this exact same issue. By any chance did you notice your solution "go offline" at any point? During my searching trying to resolve this issue, I came across your post here, and another one, here: http://social.msdn.microsoft.com/Forums/en/tfsgeneral/thread/075b878f-9d05-4819-a47b-780402a6bd02 that reminded me I had seen my solution "go offline" at one point.

    I went to File -> Source Control -> Go online, and now files are again being auto-checked out for editing again.

    Hopefully that is your issue, too.


    +1 !
    Tuesday, June 3, 2014 7:54 AM
  • Thanks Munish, your solution worked for me! Frustrating this was as we have lots and lots of projects and a handful of them don't do the auto-checkout. Even worse is I often edit and then start a build and I get the error dialog, and the build proceeds even after I cancel out of the dialog. Have to stop the build, manually check out the file and restart the build. A real pita.

    R.D. Holland

    Wednesday, November 18, 2015 7:42 PM
  • Thanks Stephane. I was facing with the same issue and your solution helped me fix it.
    Thursday, November 19, 2015 7:17 AM
  • This solution solved my problem. Thanks Munish, you're a savior.
    Tuesday, May 16, 2017 8:22 PM