I have .NET Core 7 sln with 10 projects and I am using Visual Studio 2022, version 17.4.4. The problem is that every time I add a new file to project it is not tracked be git and I have to manaully add it to Source Control. This happens for 9 out of 10 projects.
The source control is git repository.
Ignored file in Visual Studio
I have checked .gitignore and I compared projects settings across whole sln.
Is there any hidden setting in Visual Studio or solution to fix this issue?
It is possible that the "Automatically detect when files are changed outside of Visual Studio" option is turned off in Visual Studio. To turn it on, go to "Tools" > "Options" > "Environment" > "Documents" and check the "Detect when file is changed outside the environment" option.
If that doesn't work, you can try adding the new file to git using the command line, to see if the issue is with Visual Studio or with git itself.
Also, check the .gitignore file to make sure that the newly added file is not being ignored by git.
Finally, make sure that the projects are properly configured for git source control by going to "File" > "Source Control" > "Advanced" > "Change Source Control" and ensuring that all projects are properly bound to git.
Does anyone know how to open Visual studio from the command line from the current
working directory. I know that when using VS code this is very simple. You just type code . and it works. Here, I'm searching for the Visual studio equivalent.
Anyone an idea?
Found it:
devenv ./mysolutionname.sln
To get this to work, you need to make sure that devenv is contained in your PATH variable.
Also you need to run this cmd as an administrator. You can open a window from your file explorer in your current folder as an administrator, by typing ALT-F and then use arrow button||letters to navigate. Press Enter on cmd|powershell as administrator.
Tip: If you start from an empty folder, you can use dotnet-cli to create a empty sln file
dotnet new sln mysolutionname
Also you can create a new project and add it to the solution using the dotnet-cli
dotnet new console -n myprojectname
dotnet sln add myprojectname
According to the documentation there's no such switch. There is no way to set the curent working directory. But you can open an existing solution.
I'm struggling with the step from the official documentation
Extract it into a nice and short named directory like D:/OpenCV/dep/qt/ . Then you need to build it. Start up a Visual Studio Command Prompt (2010) by using the start menu search (or navigate through the start menu All Programs ‣ Microsoft Visual Studio 2010 ‣ Visual Studio Tools ‣ Visual Studio Command Prompt (2010)).
The Visual Studio command prompt
Now navigate to the extracted folder and enter inside it by using this console window. You should have a folder containing files like Install, Make and so on. Use the dir command to list files inside your current directory. Once arrived at this directory enter the following command:
configure.exe -release -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools
-no-qt3support -no-multimedia -no-ltcg
...
My issue is that in this document Qt 4.7.3 was used, now, I dont know about that version because I wasn't able to find it but in the newer one there is not Install, Make files...
which ones should I use instead?
does anyone has any step for more recent version of Qt and VS that I can follow to get this done
I turns out I wasn't using the source file, which you can find here found the folder which contains the configuration and INTALLS files on the new version in a folder called qtbase continued with the steps from there on the OPENCV guide and everything worked alright on MSVS2012
I'm not getting something about Visual Studio's Git for TFS.
I cloned a colleague's solution in Git on TFS and started adding code. I then realised that I needed my own branch for the changes I was making, and so following the instructions in Push a new local branch to a remote Git repo and track it too I ran
git checkout -b e4ctim
git push -u origin e4ctim
When I make changes to my code visual studio shows the familiar red-tick icon by the code file to reassure me that the change has triggered the file to be checked out:
And then when I save the file the Visual Studio returns the icon to the blue padlock. I assume that this change from red-tick to blue padlock signifies that the change has been checked-in locally in Git:
But when I look at the history of the modified file, there is none!
I would like to commit my changes locally and sync them with the TFS server.
Visual Studio does not see any changes at all:
From the command line I can see that Git has noticed all of my modifications by running the command
git status
and seeing lots of changes not staged for commit and untracked files.
Looing at the Git book I could use
git add
or more specifically
git add -u .
to stage the files ready for a commit but I'm reluctant to do that as the Develop your app in a Git repository (track, commit) Visual Studio documentation states:
Q: Where is the Git stage?
A: If you are an experienced Git user, you might have noticed that
Visual Studio handles changes differently than the command prompt.
You might have wondered if the Included Changes section contains
your staged changes. In fact, Visual Studio usually bypasses the Git
stage for you. When you commit changes, Visual Studio simultaneously
stages and commits them. The one exception occurs when you add a
file to your Git repository; Visual Studio does stage this kind of
change.
Visual Studio stages and commits changes simultaneously. But why is it not listing any of the modifications I have made to tracked files as changes, and thus letting me commit them?
This is more of a workaround than an explanation, but I found that if I ignored the documentation "when you commit changes, Visual Studio simultaneously stages and commits them" and instead added the modifications to staging with the command
git add -u .
then Visual Studio suddenly became aware of the modifications and let me commit them locally and sync them with the TFS server. Moreover it then put the 'new file' green cross on the files I had added and I found I could do another commit and then another sync to pick up the additions and deletions I had made.
Since then Visual Studio is doing what I would expect: when I make a change to the file the file is listed as changed in the commit window.
I still do not know why Visual Studio failed to pick up the changes until after an initial git add but at least it works now.
I had to add this line to my .gitignore:
[path to project]/node_modules/
Apparently VS2015 was crashing on some very long path in there and would just decide to give up all hope
delete the file myProject\.git\index.lock fixed it in my case.
I had the same probem and I realized the following:
In order to show the changeset, As #dumbledad said, Visual Studio runs the command
git add -u
internally for staging the updates.
If some of the files that you are trying to add to your changeset is open by another process, then the git command gets a permission error. And Visual Studio won't show the changes.
In my case, I had a document in my repo that was open by another application, and that caused Visual Studio not to show the modifications because of the Git permission error. So check if any of the files of your git repository is not open by any other application.
I'm using VS 2015 Update 1 and also meet this problem. Furthermore, at the same time, the VS' output window told me my VC.opendb file under the solution folder is occupied by another program. According to this, I fixed the issue of occupying: add *.VC.opendb and *.VC.db to the .gitignore file. Then everything goes well.
I was having the same issue with Visual Studio Update 3. VS was saving locally but not picking up any changes so I couldn't commit.
I downloaded Git for Windows from https://git-for-windows.github.io/ (thanks #fhilton), opened the Developer Command Prompt and changed directory to C:\Repos\Scheduler (the location of my source code).
I then ran GET ADD -U and received the following error...
error: open("WindowsServices\Scheduler.WindowServices.InstallLog"):
Permission Denied
error: unable to index file
WindowsServices\Scheduler.WindowServices.InstallLog
fatal: updating files failed
As others have said, it looks like the GIT tools in Visual Studio can fail silently, even for the most basic Windows level errors. Worse, it can tell you GIT is fully in sync. Command line is certainly your friend for the time being.
Open View > Output, select 'Source Control - Git' in Show Output from and check for any errors. As others mentioned, any error in Git makes MS Project silently ignore any changes.
I had this problem on a new machine with a fresh install of both VS2013 Update 5 and VS 2015 and it was driving me crazy. Then I found if I installed Git for Windows, the problem went away! https://git-for-windows.github.io/
Then i was trying to make changes but files doesn't get effected...There is a easy solution for this. The major problem is one of your git ignore files ignoring your files..
Open your local repo for instance D://repos, then look file you want
--> D://repos/project1/HomeViewModel.cs
--> Right click on it and click on Git Extentions
--> Choose +Add Files
--> then Force option
--> Click on Addfiles..Here you go you file will be added in changes
Helpful article! Using Git Bash (git add -u) helped me get closer to the cause of the problem. After committing changes previously not shown in Visual Studio, only half-way commit was done because of using a SQL Server Database Project; Apparently, Windows 10 started to add jfm-files in the same folder keeping it open all the time and preventing it from beeing accessed by VS. Solution was to add it to the .gitignore before committing.
See this thread for further information:
Visual Studio 2015 Database Project directory contains a file with extension jfm
In my case my problem was I am using Linux with symbolic links in the path to my projec (cannot tell if windows with symbolic links has the same problem)
The associated source control plug-in is not installed or could not be initialized.
Common causes for this error include server unavailability and/or incorrect workspace mappings.
O Temporarily work uncontrolled
o Permanentnly remove source control association bindings
Dear friends,
I have installed git and also the git extension,
I have used the clone repository properly,
The git system is working fine on my system, yet I m getting this error
What is the problem?The mappings?
How to solve it... :(
The OP reports that installing the git plugin for Visual Studio (should be "Visual Studio Tools for Git "), the error message is gone.
The common resolution is often to flush the local cache by completing the following steps:
Delete the contents from the following folders
C:\Users\<>\AppData\Local\Microsoft\Team Foundation
C:\Users\<>\AppData\Local\Microsoft\VisualStudio
C:\Users\<>\AppData\Local\Microsoft\VSCommon
Go to the Visual Studio IDE folder in command prompt and Run the following command "devenv /resetuserdata" from the Visual Studio IDE folder.
Typical location for 64 bit:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
Typical location for 32 bit:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE
Before following the above step please close all instance of your visual studio.
There should be a Global section in the file, which is where all of the settings for this are located. look for GlobalSection(TeamFoundationVersionControl) and remove that entire section down to EndGlobalSection.
Once you do that, reload the solution and tell it to go back online and your bindings should be working again.