File gets excluded every time the latest code is taken from TFS - visual-studio

Let's understand the problem:
For our ASP.NET project using Visual Studio 2013 premium on a Windows 7 x64
On developer A's machine:
We've got a TFS setup
We added a new file A in the project
We checked-in the newly created file in the TFS source control
On developer B's machine:
We've got the same TFS setup
We forcefully took the latest (by specific option - overwrite option) version
File A gets loaded in the project, however it stays excluded
Developer B manually includes the file in the project
The files are well included and that is our concern. Why files which're included are getting excluded on other devs' machines?
The newly added files gets loaded on dev B's machine however they doesn't show up in the solution tree. We've to manually include them in the project after show all files
There's only one mapping on each dev's machine. The code is going to locally mapped workspace only
We've a little big team, so for every developer. It happens every time we take the latest version.
How do we suppress this behaviour? Is there a setting as such?
We've tried searching the web, couldn't find a solution.

It seems TFS automatically excluded the changes. You may encounter such a situation as below:
They're not loaded in your current solution, so Team Explorer assumes they're made as part of either a different solution and
that you don't want to check them in together with the changes that
do match the context you're in.
They're made in a different workspace, again Team explorer assumes you want to check in groups of files that logically make sense.
More detail info please refer the very detailed answer from jessehouwing in this question What are "Excluded Changes" in Team Foundation Server?
And if you are working with a little big team, the way you are using to "forcefully" take latest is not a recommend solution. Suggest you to still use get latest to download the files on the TFS server. Even though you may not obtain the "really latest version" of the file. You can still work on it and figure out the conflicts if there are during the check in action.
Update
If develop A has checked in the files, but not checked in the project file( .csproj file), then TFS will not download them if you execute a "Get Latest" by right clicking on the project or solution in Solution Explorer.
You will however get the files downloaded correctly if you right click and "Get Latest" on the folder in the source control window. But, they won't get loaded into your solution, because you haven't told TFS that they belong there.

Related

Visual Studio Show All Files not working - not showing some folders and files

I've started a new project and I've copied and pasted in some test files from another project. Normally to include them in the project I'd toggle on the "Show all files" option in the solution explorer. However that isn't working and I can't work out why!
I've updated to the latest version of VS Professional 2019. I've restarted the application and my machine. I've deleted the sln file and rebuilt. I can exclude files - I just can't get them all to show! Below I've attached a screenshot of an empty project with two test files that should be showing but aren't.
Anyone know what I'm doing wrong? :(
"Show All Files" is a project level option. In a multi-project solution you would need to turn it on for each project in turn.
This was reported on the VS Developer Community here, with the suggestion that it be extended to work at the solution level as well. Microsoft's answer suggests that that's not expected to happen anytime soon: "although this is a very valid suggestion, at this time we are closing it as is not among the features we are able to fit into the near future roadmap".
Another way to show all files under the entire solution directory is to Switch View to Folder View using the dropdown next to Home, though this loses the project structure.

How to work on an external developer's project using Team Foundation Server

Me - Front End web developer with an ok working knowledge of writing VB.NET code but I have never built a .NET project from scratch using Visual Studio.
External developer - Experienced VB.NET developer but completely new to version control and TFS. Also extremely cheap and prone to infuriatingly poor programming practices. He does things that make you bang your head on the table.
Background
Our external developer has coded our site but over the last few years I have been tweaking aspects of pages and have managed to learn quite a bit of VB.NET along the way. He has never used source control and I don't think he's ever had to work with another developer before.
Up until now he has maintained a local copy of the website. He makes changes to this local copy and when he wants us to test it he uploads the relevant files to our dev server. I have no experience of Visual Studio projects/solutions so if I have made tweaks to things I have edited the aspx/asxh/config files in my preferred editor and then uploaded them to the dev server. If everything works correctly I ask him to download them from the server so he can update his local copy.
I have been maintaining a local git repository of the website for the last 2 years. If he makes a change I check it in.
Obviously this is a nightmare to work with so we have now insisted that he starts using version control. I recommended GIT but he has decided to use TFS.
He has now put his solution and all the files into TFS. I have installed Visual Studio 2015 and successfully connected to TFS. I have mapped the files from source control to my own workspace but I am now at a loss as to what to do next.
Questions
As soon as I open the .sln file he has uploaded it says I have checked out the file and made changes. When I check the diff it seems to be because I am using a newer version of Visual Studio than he is. Does the .sln file need to be in version control? Or are we suppose to maintain our own versions of the .sln file and simply check in everything else?
If I try and build the project it fails because the web.config is set up for his machine and not mine. How can we maintain 3 versions of the web.config file? One for my local, one for his, and one for our dev/live environments?
I am not convinced he will have added the project to TFS correctly because he's never used it before. This is basically the blind leading the blind.
Question 1:
You need to put the .sln file in version control. Before check out the .sln file, please do a "get latest" step, which will make sure both of you are working on the latest version. When you try to check your local version in the server, and he had uploaded his local version in the server. You may have to solve conflicts before the check in.
Question 2:
You should build your project and published the website on the server. The build agent will only maintain one version of the web.config file. If he has built the project with his web.config. And you want to build the project again with your web.config, the build agent will delete the previous web.config and pull down your version. Then build the project with your's web.config.
Moreover, if both of you are not similar with TFS. Suggest you taking a look at below MSDN link which related to source control and build.
Use Team Foundation Version Control
TFS Vnext Build

Files missing from TFS restore

I've just created the simplest little project with a Program.cs file, checked it in to Visual Studio Online, deleted the project locally, and then tried to get the latest version from the online repository. The program file didn't download, even though Source Control Explorer shows it on the server:
Any idea why this won't download?
At this point there are no changes in the files since you last did a Get-latest to your workspace. Follow the below steps to get the files for your workspace:
Right click on the file/folder
Choose Advanced instead of Get Latest Version
Choose Get Specific Version
Check the "Overwrite all files even if the local version matches the specified version" box
This will force a download of all the files and not just files that have changed since the last time they were retrieved to your workspace.

Visual Studio Online TFVC Source Control - Can't add solution

I have never used VSO before, and decided today to try it out for a small project I have. I added the solution to VSO with no problem, however I realized I made a dumb mistake and added the solution to the root of TFS. This isn't what I wanted, I want to add multiple projects under different folders. So I deleted the files from TFS and started over. Now when I try to add the same solution to VSO it fails, and gives me this error message:
A project DAFT.sln that you are attempting to add to source control
cannot be added because the item Publish-WebApplicationWebsite.ps1 is
already under source control at the selected location.
Bear in mind that I deleted this info and it no longer exists on VSO. I don't see the above file anywhere on VSO? What did I screw up now?

Get files from TFS Source Control added by another developer without checking in my code first?

I'm working with Wally, another developer on the Acorn project. (both names ficticious)
The Acorn project is an ASP.net Web Project; the source code is in TFS (Team Foundation Server). Wally tells me that he checked in new code yesterday, as I expected. I sit down and run the merge tool and take notes of the places where we've worked on the same file. I used the Visual Studio Merge Tool to merge and then proceeded to test the code.
It didn't work. The problem is that a number of files that Wally checked into TFS are missing from my machine. I can see in the "Source control Explorer" that Wally checked in at least one new file. When I right mouse click on the Acord project and click "Get Latest", I still don't get Wally's new file. This is a problem because I've added some new files of my own, so I can't just take Wally's version of the project file.
What can I do to make the project file include the file additions from both Wally's code (that is checked in) and my code (which is only saved in a Shelfset)?
I am using Visual Studio 2010.
Get the lastest version of the project file, and you will get the opportunity to merge the files (automatically or manually) as you have both made changes to it.
The project file is XML, so you should fairly easilty see what most of it means, and you really only need to understand the part that is the files in the project, so there isn't really any problem if you need to merge them manually.

Resources