Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checkout A Project With Git And Visual Studio

I recently started using Git with Visual Studio 2015 and I'm trying to modify the properties of an installer project. The issue is that it won't let me because the project isn't checked out and I don't see an option to check out the project with Git through Visual Studio. The only place I even see the mention of the words 'Check Out' is under branches and it's grayed out.

like image 895
Bacon Avatar asked Mar 09 '16 21:03

Bacon


4 Answers

I'm having the same problem in VS2015. It seems to be an issue with the Installer Project extension. For some reason Visual Studio doesn't detect when you attempt to change the Setup Project file (with YourProject.vdproj), and doesn't automatically unlock it for you. I had the same problem with TFS, but in that case all you had to do is manually unlock the file, by right clicking on it. I've just migrated to Git, and the problem is still there, but now you can't unlock the file by right-clicking on it (since there is no explicit check-out in git).

I'm still looking into the problem, but the only solution I've come up with now, is making a quick manual edit of YourProject.vdproj in Notepad. Visual Studio WILL recognize that edit, and unlock the file for you. After that you can continue to use IDE to make changes to the Installer project.

Unfortunately, the problem comes back once you check in your changes, and try to modify the file again. You will once more have to manually edit it to force Visual Studio to unlock it for you.

EDIT: After spending a few hours on this, I finally came up with a proper fix, which I verified works on a few in-house projects. Here are the steps:

  1. Open your solution file in notepad, and delete the following section: GlobalSection(TeamFoundationVersionControl)
  2. Open the solution containing locked Setup Project in Visual Studio.
  3. Go to Tools > Options > Source Control > Plug-in Selection, and pick 'None' from the dropdown.
  4. Click Yes to the dialog that warns you the project will be closed.
  5. Open the solution again, you will be prompted to permanently remove source control bindings from the projects. Click Yes to that.
  6. You can now go back to Tools > Options > Source Control > Plug-in Selection and pick Git again.
  7. At this point the problem is fixed, and you will be able to modify your Setup Project without any issues.

I found that removing bindings is clearing the values of the following tags from the project files:

<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>

Apparently SAK stands for 'Should Already Know'.

like image 105
Eternal21 Avatar answered Nov 16 '22 01:11

Eternal21


Here is a workaround I found, Mark the project installer in the Solution explorer, And click "Save" (not save all). For me it did the trick. If it's still didn't help try to reopen VS and try the method again.

Cheers!

like image 20
Ori Avatar answered Nov 16 '22 01:11

Ori


Open a command line, go to where you need to check it out, then issue the git checkout command? http://git-scm.com/docs/git-checkout

like image 1
Joe Healy Avatar answered Nov 16 '22 01:11

Joe Healy


Like Eternal21 I encountered this problem when trying to modify an Installer project, this was in a VS2013 (rather than VS2015) project though and I could not see a GlobalSection(TeamFoundationVersionControl) in the solution file. However the following steps worked;

  • Go to Tools > Options > Source Control > Plug-in Selection, and pick 'None' from the dropdown.
  • Make the change required to the Installer project
  • Go back to Tools > Options > Source Control > Plug-in Selection and select Git again.

(and the Solution did not ask to be closed).

like image 1
d219 Avatar answered Nov 15 '22 23:11

d219