Issue with Visual Studio Community 2013 and Git - c#

I just noticed the files I created (.cs, .xaml, etc) are not added to Git, so my commits+push wont upload them to the repository. I know I can go to the terminal and do git add path/to/file but I want to know how can I do this from within Visual Studio.
I tried right-click the file and search for Add to source control but the option is not listed. What do I do?
I already looked it up but every Microsoft documentation is for Team Foundation and it doesn't work for me

Make sure Microsoft Git Provider is selected as your Source Control plugin (assuming Visual Studio 2013):
In Visual Studio, on the Tools menu, click Options.
In the Options dialog box, click Source Control, then click Plug-in Selection.
Select the source control plug-in that you want to use (Microsoft Git Provider).
Click OK.
Locks should appear next to your files (assuming your project is a git repository), and you should be able to add your files.
Reference: https://msdn.microsoft.com/en-us/library/axafab5c(v=vs.90).aspx
Edit: Since you already have your plugin set correctly, you likely just need to perform a commit. I don't believe Visual Studio has a seperate interface for staging changes; when you go to commit, it should list your new files as "Included Changes", and the file should have a green plus next to it in the Solution Explorer.
Any files that aren't being committed should be listed under Excluded Changes or Untracked Files below that. You can add individual files to the commit from here.
If your file is missing the green plus, I'd check your .gitignore file to ensure it's not being ignored.

Related

Reconnect Visual Studio project to GitHub repository

I've had to reformat my hard drive. I've restored my Visual Studio projects but now I need to reconnect them to their corresponding GitHub repositories.
Unfortunately, information about that connection does not appear to have been saved with my projects.
How can I re-establish the connection between my project and the GitHub repository? Preferably, without having to recreate everything or lose any work.
I have a lot of projects I will need to reconnect to their repositories.
Note: I'm just using build-in Visual Studio commands to manage my repositories.
Note 2: I added one project to source control and it now shows every file as being added. I'm not sure if this was a mistake.
Update:
So, I added my project to source control, and tried to publish the project to GitHub. I think this overwrites everything and I lose all my current history. But I'm not seeing other options. But this gives me an error.
Error encountered while pushing branch to the remote repository: rejected Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing to the same ref. You may want to first integrate the remote changes before pushing again.
But the Pull command is disabled and says The current branch does not track a remote branch.
In order for the solution to remember your GitHub settings, you need to save the hidden .git folder.
My regular backup procedure did not copy this folder, although I was able to retrieve the old one.
Since I had re-added the project to source control, I could easily undo this by deleting the new .git folder. And I was able to copy of the original .git folder in its place. And when I loaded the project, all the repository settings were as they were before and Visual Studio recognized any new changes I had made.

Cannot add files to Visual studio 2015 (Community) Update 3 / TFS

I added some C# files that are part of a database project, then delete the EDMX (Entity Framework File) to start again after a mess up, visual studio TFS got excited and marked the files for delete) TFS is NOT my most favourite piece of software. SO OK I think - let it delete them and I will re-add said files and check in later.
Ha ha - On "Add Existing files" (select the files) / OK --- Visual studio simply silently does not add them - it does not complain, just nothing.
NB: I did do a TFS scorch to clean the workspace after the check in having saved a copy of the directory for these kind of gotchas. So that I can emulate a clean get on my machine to correct any forgotten checkins
Maybe I should add them directly into the csproj file using notepad++
You could try to install TFS Powertools, this tool provides additional Visual Studio menu options and functions:
First, map the project to a clean workspace.
Then, copy the files you want to add to TFS to the workspace, under the correct folder.
Last, right click these file and select Team Foundation Server -- Add, you'll see these files show up in Source Control Explorer, and check them into TFS.

Where is Visual Studio storing Publish Profiles?

I have a corrupted Publish profile.
I need to delete it. My other computer is fine, so I know it is local.
I have tried:
Clean checkout of codebase from Git (so nothing is local in my code directories).
Deleting C:/Users/<user>/AppData/Local/VisualStudio
Deleting C:/Users/<user>/AppData/Roaming/VisualStudio
Full text search of Profile Name 'MunicipalAgenda' through Registry
Full Text search through machine.
Creation of a new Windows User for Visual Studio Development.
Despite all of this, VS.NET is hanging onto that corrupted Publish profile.
Honestly I am at wits' end, and my next drastic step is to do a fresh reinstall of Windows 10. Please help before it comes to that!!!
Normally any publish profile store in particular project.
For that you have to look at following location.
Go to that project.
Project has special folder call Properties
Inside that there is a folder called PublishProfiles ( Something similar)
I also had some difficulty in getting my profile deletions to stick ... Visual Studio (2017) doesn't seem to be able to do it from Solution Explorer.
My latest attempt is to go to Source Control Explorer, open up the /Properties/PublishProfiles folder, and delete and commit the unwanted profiles from there. So far so good :)

Fast navigation between selected / checked out files in Visual Studio 2008 Solutions Explorer

I am working on a very large product, that has hundreads of files in 5 differnt project including one web site project
All these projects loads under one Solutions in VS 2008
We are using TFS as Source Control.
I am fixing bug in this solutions , now I have to checkout various files and open other many files to search similar/related code.
I want to quickly navigate from one file to another. I really spending some time in searching for proper file that I don't want to do.
Is it possible to group checked out files in solutions explorer? or any other way to navigate between selected files.
Any other suggestion also welcome.
Here are the few tips
Checking out files will be done automatically when you edit a file if you have these settings in VS Tools => Options.
Install VSCommands and Productivity PowerTools
VSCommands has some features which helps your productivity
Collapse All
Open File Location useful in VS2008
Locate Source File
and lot more
Productivity PowerTools has some features which helps your productivity
Quick Find (Highlights your search as you type)
Enhanced Scroll bar (easy to navigate to edited part of the files)
Solution Navigator (Type the file name to search)
Ctrl + click to navigate to definition and lot more.
I use ReSharper which has most of them in it.
You can see what you have checked-out at a glance in the Pending Changes Window.
Go to the View menu, select Other Windows, then select Pending Changes. This will open the Pending Changes window at the bottom of Visual Studio:
From there, you can double-click on any file to open it in the editor, or you can use the context menu to perform other operations, like comparing against the workspace version, the latest version, etc.
Although I didn't find any smart solution for this except using Telerik's JustCode tool.
http://www.telerik.com/help/justcode/code-navigation-and-search.html
This Tool allows me shortcut to navigate by Searching file by name and Locating file in solution explorer :)
Atleast this is giving 80% what I expected.

AnkhSVN for Subversion does not show Source-Code-Control related icons

We moved our projects (SQL Server and .Net) from Visual-Source-Safe to SubVersion.
We have installed Tortoise SVN and AnkhSVN clients on the location machine.
When I lock a file, the icon in Windows Explorer changes, but there is no indication in Visual Studio of any lock.
Visual-Studio
Windows Explorer
How do I fix this?
I figured it out!
I had added the Solution to SVN but not added the projects to SVN.
Funnily enough, when you add a Solution to SVN, it adds all the files to SVN, but it does not modify the project to manage them via SVN as well - this is a step you have to do manually.
Then the icons show up!
Make sure you have AnkhSVN as your currently selected source control plugin.
Tools -> Options -> Source Control.
add svn:needs-lock property in locked file to let AnkhSVN show file locked in Visual Studio, see:
http://ankhsvntips.net/post/2378796136/auto-locking-files

Categories

Resources