'Visual studio remembers old git repo
I am having trouble getting VS2022 to forget an old repo that a project used to belong to.
I had a project with this folder structure
bigproj
\.git
\src
bigprj.sln
\.vs
\prj1
prj1.csproj
class.cs
\.vs
\prj2
prj2.csproj
class.cs
\.vs
I am basically moving out client side code (prj2) from a server project (prj1). I moved prj2 to a new folder outside of this tree and deleted the '.vs', ''.git' folders, and any suo files.
\smallprj
smallprj.sln
\prj2
prj2.csproj
class.cs
Note there is no .git folder, no .vs folders etc. Just sln, csproj and cs files.
When I open the new solution (created from blank solution), visual studio is still showing the old git repo in the git windo and it still references the remotes.
I can't see where it is picking up this old git configuration. the sln and csproj have no references to the old bigprj location.
I will manually delete the remotes but would be good to know why it is behaving this way.
EDIT/UPDATE I am referencing a project in the old repo from smallprj.sln (a local reference that will later be changed into a nuget package). This seems to be the thing that is causing git to think the new solution is part of the old repo. If I remove the reference, the new project now acts like a project without a repo (which is desired). I can then add the external proj references back in, all is good. So there seems to be some link where the current project has no git, then it looks in other referenced projects in the solution to see if they have a git? If so, then it shows that repo?
Anyway the work around is to remove the external references, create the new git repo, then add back the references.
You may wonder why I am using non-standard referencing code outside of the project. For debugging, I am retaining local references so I can step through referred code. When those are stable, I add them to a package in the referencing project and remove the external project references (so everything is contained and remote devops builds can succeed again).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
