Project not showing as checked-in to TFS in Visual Studio 2013 - tfs

I added a new project to a Solution Folder in VS2013. I added the project to TFS via Source Control Explorer but in VS Solution Explorer the little lock icon next to the project is not displayed. I just downloaded the solution to a new computer, and that project did not get downloaded. I had to go into Source Control Explorer and explicitly get it. The solution just does not recognize it as under source control...
How do I correct this?
Any help is appreciated

You probably need to bind the project to source control.
Open the project in Visual Studio.
File > Source Control > Advanced > Change Source Control (or you might find there is only an option like File > Source Control > Add to Source Control - I can't remember exactly what this looks like)
If you get to the Change Source Control dialog, then select all the projects in the list and click Bind. If this works you should have a tick in the "Connected" column and "Valid" status, and you can OK the dialog and your project should be good to go. If binding fails, then Unbind everything and try binding again.

Looking back to basics, I discovered some of the files (such as the project file itself) had never been added to source control. I discovered this by going to Source Control Explorer, selecting one of the projects unmarked in Solution Explorer, right-clicking to get the context menu, then selecting Add Files To Source Control, then selecting the whole list presented, then clicking OK/NEXT/FINISH. That marked the unmarked project in Solution Explorer with a plus sign (+) to be added. Then again from Source Control Explorer I selected the solution and clicked Check In Pending Changes. Then I got the lock icon in Solution Explorer.

If the Projects/Folders are missing in Source Control this can be done -
Open TFS -> Source Control Explorer -> Right click on Solution folder and click 'Add Items to Folder...'. Now in 'Add to source Control' prompt select the folder of desired project that needs to be added to source control. On doing so the project folder along with its content should appear with + sign and on check-in the project will be available under the solution in source control.

This is the reason due to solution is available on TFS but local instance is not bound to server directory.
Solution:
Files=>Source Control=>Advanced=>Change Source Control
Then Bind all projects to server repository location.
This will resolve the issue.

Compare with another correct project,I know it's lost xxxx.csproj.vspscc file for my project.
for init this file.
First , you should open right project and add error project in current solution.
Then,Right click error project click Source Contorl → Add Item to source control
Then, source control will warn you
Click Continue
Source control warns you again to rebind item
you shoud click Ignore All
After check out and check in error project,It will be ok.

Related

How to make TFS detect changes in folders outside solution?

I'm making an angular webapp for a C# solution and I have to use TFS.
I set my workspace as local (as described here) and added the angular folder from Source Control Explorer.
Now all existing files are marked with the [add] tag and I can check-in them, but I can't understand why added or removed files are not detected as pending changes.
What am I missing?
They're under "Excluded" changes. You'll see a marker that says "Detected: X adds" or "Y removes". You can click it to promote them to tracked changes. It assumes that stuff that's being added or removed outside of Visual Studio isn't intended to be in source control, so it doesn't start tracking until you tell it that you want them to be tracked.
This may not be the perfect solution you're looking for, but I ran into an almost identical issue. This is how I solved it,
1) Open Solution Explorer in Visual Studio
2) Find your Project ( Angular Project )
3) Right click on it, and click Compare changes.
4) In compare options see View Options and check the following:
Show items that exist only in source path
Show items that exist only in target path
Show items that are different
5) Then find all the files that are in your local mapping that are missing from your server version, right click on them and click "Add file". You should be able to do this for entire folders / groups of files using shift + click .
6) Once you've added all your missing files, make sure they're being tracked in Team Explorer -> Pending changes, then check in your files.
I haven't figured out how to get Visual Studio to track these files automatically as I believe it requires a solution file like in normal C# projects to track them, but I could be wrong.

Force TFS to detect changes

Seems like this should be something very simple, but I can't find how to do this...
I made a changes to several files spread within a repo by using a script that I wrote. Problem is TFS in its infinite wisdom does not think the files have changed. Aside from manually finding each file and clicking "checkout for editing" is there any way to tell TFS to just rescan everything and detect changes?
A Folder Compare (File->Source Control->Compare...) should do the trick. Select the top folder from where to start comparison, and select to compare with Latest Version. The result hould show files that are changed, and whether they are checked out or not.
TFS has a "Reconcile" command for this. See https://stackoverflow.com/a/22860674/932282 for a complete answer.
Local Workspace
You need to work with a local Workspace. Here's how to manage workspaces:
visualstudio.com: "Create and work with workspaces".
When adding or editing the workspace you click Advanced >> . Then you set Location: to Local.
Now when your script or anything else changes files outside Visual Studio, your workspace detects the changes automatically.
It also detects adds or deletes but you have to include them to your Pending Changes manually with the link under Excluded Changes
BUT BE CAREFUL. When adds or deletes get detected and you add them to your Pending Changes, the files aren't automatically included to your project. So you maybe check them in to TFS, but they aren't listed under the Solution Explorer.
Matt Burke has a fix for that problem:
mattburkdev.com: "Automatically Include All Files in Folder in Visual Studio"
To edit the Project file you rightclick your project, chosse Unload Project, then rightclick on it again and choose Edit. After you edited the project files save and close it. Then rightclick and chose Load Project.
But with that you also need to be careful, because the Project only searches for new files in these folders to include, when you load the project and not while you have the project open. So when some files get added outside Visual Studio, you just reload the project.
Server Workspace
But if you have to stick to a Server Workspace for some reason i got another trick for you:
FIRST:
Check out all Files that maybe have pending changes (better check out many files). Then go to Team Explorer -> Pending Changes and choose all files you just checked out. Then choose "undo changes". After this you get a message "Confirm Undo Checkout". This message ONLY pops up for the files, which actually HAVE changed! Press "NO" for each files or "No to All".
FINALLY: Under pending changes all files get removed from the list except the ones which have pending changes.
I hope I could help someone and you didn't have to search for this solution as long as I had to ^^
If any of your changes occured when you were offline, you can go to File > Source Control > Go Online, and all files will be checked for modification.
If none of the above work, you can also try to rebind your projects by going to File -> Source Control -> Advanced -> Change Source Control.
In Visual Studio 2015:
Source Control -> Advances -> Refresh Status
I had this problem a while age when i moved project from one pc to another.
the solution was to remove temporary files that TFS had created in solution folder.
Delete .vs and hidden $tf folder.
If no luck,on your local PC copy your solution folder to another, remove all files inside solution, get latest version from TFS server ,then from the copied folder just grab neccessary and edited files and put them back to solution folder (this will overwrite some files).
After all don't forget to check project mappings and if everything seems correct try right clicking on solution and 'Add to source control' option.
Dtsx file dropped in TFS folder was not being recognized.
On your Visual Studio (2015) home screen, click on the Team Foundation Server link. Make navigate to the correct branch.
On the window on the left side of the screen, navigate to the folder that contains your file. Expand the folder.
To the right of the folder you will see three dots. Click on those and then click on “ + Add File(s)”.
Choose “Upload Existing Files”. Then you can drag and drop your .dtsx files into the window and then click Okay.
Finally, you’ll have to do a ‘Fetch’ to add the files there. Then you need to do a ‘Pull’. Lastly, you can commit the change to remote branch.

Why are all files write protected and how can I check-in?

I currently work with a Team Foundation Server and Visual Studio. Since two days, I keep getting error messages that I can't write to files (it seems not to matter which file I try to access). I am the only one in my team who has those problems.
So when I try to check-in, I get:
When I click on Overwrite, I can overwrite it. But when I try to check-in pending changes, I don't see any changes. If I modify a source file, I can compare it to the latest version and see that there are changes.
How can I fix this? I simply would like to work ...
Work-around: If I "Check Out for Edit..." the file (so I get the lock) I can edit it. But this doesn't work for the solution file, because somebody else checked it out.
Go to Solution Explorer
Right click on your solution
Click Go online
It seems that your solution is not connected to the Team Foundation Server.
I would recommened that you remove the mapping of your workspace, delete all local files of the workspace and then get a fresh version (Get latest version) from the Team Foundation Server.
To remove mapping you need to open the Source Control Explorer in Visual Studio. Navigate to the Branch you are working on and open the Context Menu (right click on branch). In the menu you select Advanced->Remove mappings....
In the dialog you can edit or remove the mapping of your workspace. (Note: When you select Remove mapping then will all files in the Local Folder be removed that are controlled by TFS)
What you also can do is to check the state of your workspace/solution if it is connected to TFS. To do that you need to open the solution in Visual Studio and then open File->SourceControl->Advanced->Change Source Control... in the File Menu of Visual Studio.
In the Dialog you will see if your Solution and projects are connected to TFS and the server they are connected to
You should have the correspondings local files like in the source control.
Go to the local file, right click on it and choose Properties,
in the opened dialog uncheck the read-only checkbox, click Yes to the question if you want to apply changes to all subfolders and files.
Hope this is helpful.
You will face the same problem when setting your Workspace location to server (which in my case happened somehow magically).
To change the location to local again open the source control explorer and in the upper part you find a drop down labeled "Workspace". From this drop down choose "Workspaces...". This opens the "Manage Workspaces" dialog where you can select your workspace and click the "Edit" button. In the Edit dialog click the "Advanced" button and you'll see a drop down for Location where you can change it to Local again.
MSDN provides detailed information on the pros and cons of local and server workspaces.

Exclude from project, source control issue

I'm using team foundation server 2010 # work and home.
I want to exclude some element from the project build but still have them exist in Team Foundation Server 2010 source control. How do I achieve this?
Exclude From Project will delete the item.
Same problem here, only way to do this is manually edit project file :(
Please vote that this bug is important to fix
https://connect.microsoft.com/VisualStudio/feedback/details/573582/vs-2010-exclude-from-project-deleting-files-from-source-control
Workaround posted on Connect:
Open the csproj file in notepad and find the files that need to be
excluded and remove or comment the compile element for that file, and
any related designer and resx files.
Editing a project file and removing the references to the files you want to exclude would be the easiest solution.
Another solution would be to remove files from the project via UI, but only checkin changes in the project file and undo the delete operations.
In the future you can add files directly to the TFS folder in Team Explorer.
May I ask: why would you want to do that? As I commonly have a problem of files which are not bound to any project and have to be getted manually.
I work in a TFS environment, and if it were me? I'd just change the name of the file (instead of excluding it from the project), and check that in instead. Since your project is expecting that particular filename...it won't find it. We use this when we're developing prototypes or holding on to antiquated code for documentation purposes. Sorry VS is eating your stuff!
Kind Regards,
-sf
I think these steps should help you do what you are looking for.
To exclude an item from a deployment project:
In Solution Explorer, select the file you want to exclude.
On the Solution Explorer toolbar, select Properties.
In the Properties window, set the Exclude property to True.
And this page explains the actions for project files supported by VS 2010:
http://msdn.microsoft.com/en-us/library/0ebzhwsk.aspx
--- Edit ---
At work I tried 'Exclude From Project' in one of the files of a project we have in VS 2010, which is bound to a TFS 2010 server, and this action did not delete the item from TFS; the Source Control Explorer window shows the red delete mark next to the item, and the 'Pending Change' column says delete, but item is there. Right click the item in the Source Control Explorer window, one of the commands in the context menu that pops-up is 'Check In Pending changes' and another one is 'Shelve Pending changes'. Shelving enables you to set aside the pending changes.
The file is still in the local hard drive. If I do 'Include In Project' the item comes back to normal.

How do I change my workspace in Team Foundation Server 2005 and 2008?

I have multiple projects in a couple of different workspaces. However, it seems like I can never figure out how to change my current workspace. The result is that files that I have checked out on my machine are shown to be checked out by somebody else and are not accessible.
I'm going to assume you mean "workspace", not "workstation", as your question doesn't quite make sense to me otherwise.
In Visual Studio, go to the Source Control Explorer (View->Other Windows->Source Control Explorer). At the top of the source control explorer window you should have a toolbar with a few buttons. Somewhere on that toolbar (for me it's at the right) there should be a Workspace dropdown. Just select the workspace you want to use from that dropdown.
Are you wanting to change the location of the files on the workstation? If so, here's how I do it:
Open Visual Studio
Open the Source Control Explorer window.
From the Workspace dropdown select "Workspaces..."
The Manage Workspaces dialog should show up.
Select the workspace you want to modify, and click Edit...
You should be able to adjust the folders from here.
First, you should active you workspace window.
choose the window menu
click Source Control Explore.
click Active button.
The Workspace window appears
click the WorkSpace name in Workspace window.
from the popup list choose the Workspace name you want.
In Visual Studio 2013
If you just regret which local folder you choose for a project under version control. Do like follows:
In the Source Control Explorer in the Folders pane
Select the project which local folder destination/mapping you are not pleased with.
Right click. --> Advanced --> Remove mapping.
A window opens: Press the browse button and choose another local folder for the project and then click "Change".
Click on: File -> Source Control -> Advanced -> Workspace and then you can edit or remove the existing mapped locations
I don't entirely understand your question.
Are you saying that files you check out on one machine seems to be unaccessible on another of your machines? I'd say that would be entirely by design, as now you have a file that has local modifications done on one machine, which may or may not be available on your other machines.
When you say checked out by somebody else, what does that mean exactly? How are you verifying this, what are you looking at?
Or do you mean something else? In that case, please elaborate.

Resources