Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Edit a File in VS2010 & TFS w/o checking the file out

I'm working with TFS 2010 and I need to edit a file localy without checking it out. I want to be able to edit the file in VS2010, is this possible?

like image 589
Rossini Avatar asked Jun 07 '11 19:06

Rossini


People also ask

How do I edit a project in Visual Studio?

Then, right-click on the project and choose Edit <projectname>. You don't have to use solutions or projects in Visual Studio to edit, build, and debug code. You can simply open the folder that contains your source files in Visual Studio and start editing.

How do I edit a project in Visual Studio 2017?

Right-click on your project in solution explorer and select Unload Project. Right-click on the project (tagged as unavailable in solution explorer) and click "Edit yourproj. csproj". This will open up your CSPROJ file for editing.

How do I open a .RC file in Visual Studio?

While having opened the Visual Studio with your project, go in File Explorer to the RC file in your project, right click and open with Visual Studio 2017. The RC file will be opened in the curent project and everything will work like a charm.


5 Answers

The defective "Save as" dialog Rossini refers to above is a known bug in VS 2010, with the official response being "Won't fix"

https://connect.microsoft.com/VisualStudio/feedback/details/765219/tfs2010-save-as-dialogue-does-not-overwrite-an-un-checked-out-file-when-solution-is-open#

This effectively makes it so you cannot use "Edit: Do Nothing" and removing the read-only attribute as a way to work with single files offline without a check-out. So from all the work I have done the answer to this question is "you cannot", at least not in any effective way.

The alternatives (none of which are reasonable, usable, or accomplish what you want in scratchpad file editing) are to take your whole solution offline or only load the file directly in a separate instance of Visual Studio (that is, outside of the Solution), at which point you lose a bunch of references and Intellisense and might as well use Notepad++.

I just wanted to get this final information out for those (like me) who have searched for a way to do this. The last time I checked this was still broken in VS 2012 as well.

[Edit] I have not looked at any of the plugins or addons mentioned, only off-the-shelf Visual Studio.

like image 85
Liu Kang Avatar answered Oct 08 '22 00:10

Liu Kang


You can edit a local file in Visual Studio without checking it out by remove the read-only attribute on the file (DOS command: attrib -r). The editable file will not show up in your workspace's pending changes.

Leaving a lot of editable (writable in TFS-term) files in your local workspace will increase the number of merge conflicts when you do a get latest, and someone else has changed these files. You can search for these editable but not checked out files in your local workspace using the TFS command line power tool: "tfpt.exe online".

More information on the tfpt commands can be found here.

like image 40
Duat Le Avatar answered Oct 08 '22 00:10

Duat Le


You can tell VS / TFS not to check out on edit, Tools / Options / Source Control / Environment

Change Saving to "Prompt for checkout" and Editing to "Do nothing".

TFS Checkout Options

like image 27
James Reed Avatar answered Oct 07 '22 23:10

James Reed


Yes. Get the file and then disconnect from TFS (Work Offline). You will not check out the file.

Or just edit the file and do not check it in. Undo the changes and the file will never be checked-in.

like image 37
Scott Bruns Avatar answered Oct 07 '22 22:10

Scott Bruns


I believe you are looking for this:

  1. Edit your VS options like this: enter image description here

  2. Edit your file and click Save. At this point, you'll get a warning dialog like this: enter image description here

  3. Hit Ok and then modify the file's read-only attribute and then save again. This will allow you to save your edits without checking out.

like image 38
Mrchief Avatar answered Oct 08 '22 00:10

Mrchief