I have a folder in my workspace that insists on being mapped to a different location. I only mapped the root folder of my TFS project. The entire folder structure comes down to that location without exception when I get source... until today. I was troubleshooting the state of a web project and among other things, removed the entire solution folder (renamed to another location) and forced a get of the solution fresh from TFS. Now when I get latest, everything comes down correctly, but as soon as I open the solution, I get several messages that say Replacing (moved from ). One folder of the solution is moved and workspace working folder mapping shows up mapping that folder to the new location.
History:
My version of the web project had been upgraded from a website to a web app, and we needed to get it in a state consistent with the rest of the team. We removed some sites from IIS, deleted the solution directory, rebooted, and got the latest source code again. The website/web app problem was fixed, but now I have this persistent workspace change that acts like malware.
What I've tried so far:
Deleted TFS cache at Appdata\Local\Microsoft\Team Foundation
Deleted TFS temp files at Appdata\Local\Temp\TFSTemp
Removed the workspace mapping, deleted the solution folder again, restarted Visual Studio, got latest source again. The source is downloaded correctly, but when I run the solution, the working folders are mapped again, and the folder is moved again.
Checked the type of workspace. It is a server workspace (legacy).
Performed a Repair install on Visual Studio 2012.
Installed Visual Studio 2013.
Removed the workspace mapping and allowed Visual Studio to perform another get. This restores the solution structure, but the problem returns if I 1)Close and reopen the solution, or 2)Get latest on the solution (without forcing overwrite).
We did finally get a resolution for this in my case. Although I had asked the rest of the team if they had seen this behavior, and got no affirmative responses, when I investigated in detail, I found that many members of my team simply were not aware of their workspace much at all, and did not see that these mappings were being added. Not all members of my team had this issue. I believe everyone that was on a Server workspace did have the issue.
Once we realized that the problem was not unique to me, we found that the solution file was compromised. When we looked into the solution file (.sln) with a text editor, we could see the unwanted mappings represented there. We removed from the solution everything that was being remapped, and then added them back in. After double-checking that the unwanted mappings were no longer written in the solution file, we checked that in, and as each developer removed the added mappings, and then got latest again, the problem was resolved.
Related
I develop a few small projects in Visual Studio solo and for my needs using a repo like GitHub or Azure Repos just seems a little over the top. I therefore save my projects to OneDrive and develop my projects and when ready to publish and move onto the next build, just copy the existing project directory for version control and start work on to the next version.
However quite often I get stung when building projects
Couldn't process file <file>.resx due to its being in the Internet or Restricted zone or having the mark of the web on the file. Remove the mark of the web if you want to process these files.
I then have to copy the director out of OneDrive to an unsynced area such as C:\Temp and it builds just fine but then has the issue of remembering to copy back my modified project once done. There seems to be no clear cause of it and the file properties does not have the usual 'Unblock' option:
Has anyone come across this with OneDrive, or any suggestions as to why it's happening? I'm sure the main suggestions would be use a repo solution but this method works just fine for me other than this issue so I'd ideally like to get a solution using OneDrive.
Edit: To confirm I've added my OneDrive path into the Visual Studio trusted locations area and tried adding file://[pc-name] into my local intranet trusted addresses area without any success.
My problem is IDENTICAL to yours. I have tried adding the pc to the safe sites list, I've tried adding to trusted location, I don't have the unblock checkbox that many people mention, I also tried using a powershell script to unblock the file. No luck. The only solution was to do a repair of Visual Studio. That fixed the issue for me so that it stopped happening.
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.
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?
I have multiple solutions that were previously mapped to a hosted TFS. Their local mapping was defined as well and all the source code was up-to-date locally. I have since discontinued my TFS subscription and started using visualstudio.com as my TFS server.
I went into one of the solutions, deleted the *.vssscc files from the solution and the *.vspscc files from each nested project. When I open the solution in VS 2013, the output window gives me a message saying the the original TFS (unsubscribed now) is not available and that the solution is open offline.
As a result, when I choose the "Change source Control" option, it first asks me to log in to the old TFS whose credentials are no longer valid.
Furthermore, it tells me that the local directory I am trying to map to the new TFS is already mapped to the old TFS. How can I remove this mapping without having access to the old TFS?
Not sure if this works if you're offline, but you can remove the mapping by opening the Manage Workspaces area in Source Control Explorer (click on the ... option of the dropdown to the right of Workspace:)
Manage Workspaces -> Select your workspace -> Edit -> Remove or change your mapping.
It's probably easiest to remove the mappings using the commandline
tf workspaces /remove workspacename;owner /collection:http://urlto.old:8080/tfs/ProjectCollection
After removing the old workspace configuration for the current folder and mapping the folder to your new subscription, Visual Studio should prompt you to automatically update the solution bindings to the new server.
This will not delete your workspace from the server (which keeps track of the workspaces), but since you no longer have access to it, it should be enough to let your client forget the folder is mapped.
The answers here work when the old TFS server is available. Mine wasn't but has not been removed from the server list in VS. Removing that entry allowed me to remove the solution from source control entirely along with the mapping and add it to another source control server.
I started a new project this morning and, after putting ~3 hours of work into it, I tried to open a file from another project to get some code from it. I got a warning about discarding an unsaved object. After telling it to go ahead, I realized that it was referring to the project I had just been working on and not another file that I had just opened.
Even though I never saved the project, the various files containing my code and dataset had to exist on the hard-drive. Are they still there, perhaps in a temp folder? I'm developing on a box running Server 2008 R2 (don't ask, not my decision :) ).
This may help:
http://blogs.msdn.com/b/saraford/archive/2008/02/14/did-you-know-where-visual-studio-saves-auto-recovered-files-in-the-case-of-an-unexpected-shutdown-151.aspx
Also check C:\Users{Username}\AppData\Local\Temporary Projects
You could try one of those undelete programs and see if it finds anything.
Tools > Options > Projects and Solutions
and check the item
Save new projects when created
Save frequently. :)
Need to give one related input. Who the hell had the idea to implement this feature???
I used Visual Studio until 2003, then came back again to 2010 now.
After 2 days work, saving all the time, as I used to (Ctrl + S), I close the project and decide not to save the solution itself.
Done. All lost. Nothing can be recovered from anywhere in the computer.
How can a developer implement a dumb idea such as dropping all work in an "in memory" project.
You either know about it already or you will get screwed; like thousands found on Google during my desperate search.
Did Microsoft VS team look at it at least?
So frustrating...
It might be worth checking out the folder where AutoRecover files are saved.
You can find the default file location in Visual Studio on the Tools - Options menu. Look in the Projects and Solutions section - expand that and look in General to find the default file locations.
My files were under C:\My Documents\Visual Studio 2008\Backup Files.
I had this happen to me this morning. I worked on a new project yesterday and windows ran an update last night. Despite having debugged my program - the project had not saved - for some reason it didn't occur to me that the project might not be saved. I left the program running on my computer when I went to bed. This morning when I work up, I saw that windows had run an update. A few hours later, I saw that my computer had no trace of my program. I realize this is an old post, but I thought I would shed some light on what I did, since i was able to recover my files.
First I went here: http://windows.microsoft.com/en-us/windows7/recover-lost-or-deleted-files
In Visual Basic 2010 Express, a backup folder is created with your project name. Sure enough, my project backckup folder was there: Documents\Visual Studio 2010\Backup Files\MyProject. But, the folder was empty. I "restored this folder to a previous version" using the steps listed in the link above. After doing that, the folder was still empty, BUT, the temporary folder "C:\Users{Username}\AppData\Local\Temporary Projects" now contained my project's folder and files. Prior to running the "restore to previous version", the temporary projects folder was also empty.
So, I was able to copy the folder out of the Temporary Projects folder and I am as happy as one can be - or close to it.
Hope that helps someone out.
A note to the answers above, I had a mini jumpscare when i could not find my project anywhere, not in the recent projects nor in the visual studio projects folder.
I eventually found the project in the visual studio projects folder of the admin user;
I was looking at:
C:\Users\LocalUser\Documents\Visual Studio 2015\Projects
Whilst the project was saved under:
C:\Users\LocalAdmin\Documents\Visual Studio 2015\Projects
Bottom line is; also check the \documents of the admin user. This likely happend because i was testing an admin only application and visual studio was running with the admin's user profile loaded.