Visual Studio not seeing all my files after git pull - c#

I am working on a C# project from 2 computers. I made changes from one of the computers and committed the changes and then pushed them to gitHub. On my other PC I pulled the changes using git pull command.
Now I can see the new files added to the project in windows explorer. but visual studio doesn't see them for some reason.
I even deleted the whole project on the second computer and cloned the project again but that didn't help.
What am I missing? is this related to VS project settings?

Likely your changed project file was not saved or not committed. Check the commit has changes to the .csproj file. If not, save the changed project file, and make a new commit.
I have been bitten by this a few times, and now mash ctrl-shift-s (save all) in VS before committing.

Such of hundreds of problems:
Close solution and reopen it!
It

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.

VS2017 MVC project wont open from .sln but Team Explorer works fine

I'm working on a project which creates large XML files of 800k plus. I was having memory issues so I changed my IIS option in Tools>Options to 64 bit which helped. The problem worsened when my project hung and wasn't responding so I closed it forcibly. When I tried to re-open from the project .sln it told me it was incompatible even though the Team Explorer showed my latest changes as below.
It produced a Migration Report which looked like this
The project folder layout looks like this
I've tried running old backed up folders but VS2017 always says they are not recognised and tries to migrate them, some are only three or four days old! Has this reset broken my Visual Studio, do I need to re-install? I don't really have the time to mess around with this but if I can't restore from GIT/Team Explorer or backups, i don't know how to get my project running again. It seems ridiculous that Team Explorer shows my latest changes but Solution explorer is blank!
Team explorer is only concerned with files on disk, it isn't trying to run anything. Solution explorer needs to open the solution file, read the contents, and interpret them in some way. It is failing to do this. This is why the former is working, when the latter isnt.

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 :)

The code behind file is not being updated when published to IIS

I am working on an ASP.NET project which is published to a configured IIS in the same machine.
I have made changes in one of the forms and than published it.
But while the changes on the web from file (.aspx) are being updated - other changes which reside in the code behind file (.aspx.cs) are not being updated.
My aim is to search addresses from a database and to display markers on google map.
Everything is working fine from my VS-IDE execution but after publishing it to the local IIS:
The front end is working fine while the back-end (the related .aspx.cs) does not work.
I tried those steps to remedy the situation:
I have deleted app directory from windows/frameworks/4.0/temp files.
I have even made new profile in publish wizard and published the project from a new folder.
I have deleted pool from IIS and made new one and mapped it to new ddl files folder.
I have also gone to project /properties/publish web/items to deploy and set to all files in the project.
But none of that solved the problem........
I am using
VS 2012
SQL Server 2012
EF 4.5
Do a clean and rebuild, then publish. Sometimes, sometimes, a change to a dll won't be detected and so won't be recompiled.
Try to delete everything in the bin directory wherever you're publishing the site, then try to publish again. Sometimes VS doesn't like to overwrite the dlls when publishing.
This is very late but search brought me here. The solution that worked for me was, in Visual Studio:
In solution explorer, right click on your project -> select "Build Dependencies", remove any incorrect dependencies.
In solution explorer, go to Project -> References, remove any unnecessary references.
Make sure your project is selected in solution explorer, on PROJECT top menu, select "Convert to Web Application." Ok.
Clean and Rebuild your project.
Publish. It helps to set your File Publish option in Publish Profile to "Delete All Existing Files Prior to Publish"
The code behind files do not get uploaded, because they don't need to get uploaded. Only config and markup files. All the project code is contained in your project's DLL file in the BIN folder.
Hope this helps somebody out there.

Should I put Settings.Designer.cs under Version Control?

Visual Studio autogenerates this file. Searching for info on it tells me to never edit this file. Fine, but do I need to store it in my VCS or can VS auto-regenerate it whenever needed?
I believe that Settings.Designer.cs and other similar files should be under version control.
I ran into problems using the advice of the other answer here on this question.
Settings.Designer.cs is only modified if changes are made to Settings.settings, and it is auto generated by Visual studio, but not by build tools.
When I removed Settings.Designer.cs I ran into issues where Visual Studio wasn't auto-generating the file when expected, and I had to do several rebuilds/reloads of my project until finally it randomly appeared, and I'm not sure what actually triggered it.
Also I was having issues on our TeamCity build server because the build tools there were not generating the file, so I had build failures saying it was unable to find Settings.Designer.cs
I found a good rule of thumb in this answer on another question, that basically if the build system modifies the file, then don't put it in source control, but if it is only modified when you make changes to another file and is generated by visual studio, then it probably should be in version control.
Also, Visual Studio 2017 can automatically create a Git repo with a .gitignore file when creating a new project, and by default all of the *.Designer.cs files are included in the Git repo.
The problem with adding these items to version control is, that different version of visual-studio, or perhaps other environments may generate these files in different ways. This sometimes leads to irritating conflicting errors on build servers ect.
VS can auto generate this file.
After reading this answer, I went ahead and deleted the Properties/Settings.Designer.cs but got an error when building the project that "the file was missing". My project still had the references to it. So it is important that you also remove the references from the Project.

Categories

Resources