简体   繁体   中英

When I open my project, I get this message: "This solution is offline. [Team Foundation //https://xxxxxxxxxxxx/tfs/applications"

This solution is offline. [Team Foundation Server: http://xxxxxxxxxx/tfs/applications] The solution was offline during its previous session and will remain offline.

What kinds of problems would cause the above error? And when this happens, there is no check-in option and trying to save individual files results in a message that says the file you're trying to save is write protected. Do you wish to override? I can still save files by responding "yes." But all this is very confusing and dangerous. What causes this condition?

What kinds of problems would cause the above error?

I assume you're using a non- git TFS workspace (ie using TFS' old-school centralized source-control service that essentially is Microsoft's not-invented-here take on SVN.

TFS workspaces come in two flavours: "Local" and "Server" . A "Local" workspace is kinda like a git repo in that it allows you to make check-ins while working offline but it has limitations. A "Server" workspace requires you to have an active and reliable connection to the TFS server and you cannot make check-ins while disconnected (you can still make changes, of course, but you can't save them to TFS).

I assume you have a "Server" workspace instead of a "Local" workspace, hence the error message.

And when this happens, there is no check-in option and trying to save individual files results in a message that says the file you're trying to save is write protected.

Correct. But you can always remove the Read-only flag on your files in the filesystem and edit the files and do a manual sync to make a TFS check-in after you've reconnected. The files are marked as Read-only because TFS is designed around locking files and checking-out files from source-control, so it wants to discourage you from editing files that haven't been checked-out. If you do edit a file that hasn't been checked-out you can still include it in a check-in but you need to retroactively check it out when you reconnect to the TFS server.

I can still save files by responding "yes." But all this is very confusing and dangerous.

It's not really dangerous - the whole point of a version-control system is to get the freedom to make arbitrary changes and be able to rollback (or branch) whenever you want (except doing so using TFS rather than git (especially when offline), is just a rather huge PITA).

To resolve this situation:

  • Open Visual Studio (you don't need to open a project/solution first).
  • Assuming you're using VS2015 or later, open Team Explorer.
  • Ensure Team Explorer is in TFS mode instead of git mode:
    • When in git mode you'll see buttons like "Changes", "Branches", "Sync" which have a red highlight.
    • When in TFS mode you'll see buttons like "My Work", "Pending Changes", and "Source Control Explorer".
    • If it's in git mode, switch to TFS mode by clicking the Connect button in the tool windows' toolbar at the top and select your TFS server.
    • You may also need to go Tools > Options > Source Control > Current plugin: "Visual Studio Team Foundation Server".
  • After reconnecting to TFS, reopen your project/solution.
  • VS should detect that you made changes while offline and offer to create a pending check-in for you (and automatically check-out any edited files). If not, open "Source Control Explorer" and manually run the "Compare Folders" tool and check-out any files it detects as changed before making your new check-in.
  • You may also need to go File > Source Control > "Go online"

Here's a screenshot from Visual Studio 2008 (it's the only screenshot I could find, sorry - but the menu layout is identical):

在此处输入图片说明

After you've done this and made your check-in, it's very important that you visit your local fishmonger and buy a large trout, then visit your project manager and give them a jolly good slapping with it for requiring their team to use TFS in 2020. Even Microsoft uses git internally.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM