Visual Studio 2015: New file marked as “checked in” instead of pending add in TFS.

I’ve recently started using Visual Studio 2015 quite extensively for a development project. Overall, my impression of the latest release is favorable. It feels snappier than older versions and the touch of color that’s been brought back compared to 2012 is most welcome.

However, I have run into an issue I believe is new to version 2015. Once in a while, a coworker or I will add a file to a project and Team Foundation Services will immediately mark the file as “checked in.” I am sure there are certain conditions under which this happens, but I haven’t determined what those are. The file of course is not checked in, VS 2015 just thinks it is. The file will not show up in the Pending Changes view. Moreover, attempting to edit or delete the file and then perform a check-in also won’t work. TFS/VS mark the file for edit or delete, but then conclude that the file doesn’t exist in the source control database and fail the check-in.

Other symptoms of this may be hard to spot. If you’ve got a large check-in, you likely won’t notice this the file isn’t in the Pending Changes list until a co-workers tells you you “broke the build.” That’s because the file will be missing from their project even after they get the latest version. You won’t see the file in Source Control Explorer, even on the machine where the file exists.

The solution fortunately is rather simple: select the file in Solution Explorer and click the Refresh icon at the top of Solution Explorer. This will get Visual Studio to realize that the file is in fact not checked in. It will instead mark the file as not under source control (you can tell because there will not be any source control icon next to it). Now, you can right-click on the file and select “Add file to source control.” The file when then be marked as “Add” and you can check-in your changeset as usual.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s