Unshelve to a different branch using Visual Studio Online - tfs

Is it possible to unshelve to a different branch using the new Visual Studio Online TFS repository? I've tried using TFS Power Tools 2015 and the following command:
tfpt unshelve /migrate /source:"$/Sportlabs.Sportbench/Development/Sportlabs.Sportbench" /target:"$/Sportlabs.Sportbench/Development6/Sportlabs.Sportbench" "SR-Coaching"
I ran this from C:\Code\TFS\Sportlabs.Sportbench, which is mapped to $/Sportlabs.Sportbench in my local workspace. I've tried using both the Visual Studio 2015 and 2017 Developer command prompts. However, I keep getting the unable to determine the workspace error.
I've read that MS have abandoned power tools in TFS 2017 and built most of them in to TFS. If that's also the case for VS Online, how do I go about unshelving into a different branch?

To identify the current Workspace, tfpt seems to use the Method:
Microsoft.TeamFoundation.VersionControl.Client.Workstation.Current.GetLocalWorkspaceInfo(workspacePath)
I've jsut tried with TFS 2015 API and the call returns no result againt a Workspace of a VSTS project. I've also try with the TFS 2017 API and it works.
I don't think it will ever be possible to use TFPT 2015 againt a VSTS project to do TFVC operations.

Related

ProvisioningImportEventsCallback in TFS 2017(on-prem) when importing work item type definition

I'm trying to import modified WITs to a existing project. But, It was showing the below error:
Microsoft.TeamFoundation.WorkItemTracking.Server.ProvisioningImportEventsCallback
Earlier it was working fine. But, now the issue started.
What could be the possible solution for this? I just wanted to upload WITs through Command prompt(witadmin.exe) only. Any hints/information would help
From your description, you are trying to use VS 2015 to connect to TFS 2017. Please check documentation Import, export, and manage work item types:
If you are connecting to TFS, you must use the same version of Visual
Studio or Team Explorer as TFS. For example, if you connect to a TFS
2017 instance, you must connect from Visual Studio 2017 or Team
Explorer 2017.
TFS 2018 and TFS 2017
Visual Studio 2017 or Team Explorer 2017 client:
%programfiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer
or, TeamExplorer, Professional or Enterprise in place of
Community, depending on the version you've installed.
You should install VS 2017 or Team Explorer 2017 to run this command. Although VS 2015 could run witadmin command against TFS 2017 sometimes, there would have unexpected issue.
However, I found the solution for this issue by myself.
Clear the Team Foundation cache from your server and the user system from the below path:
C:\Users\\AppData\Local\Microsoft\Team Foundation\7.0 (or 6.0)\cache
Delete everything from the cache folder and restart the server\system. Then Login to the server. Now, you won't get any error for uploading [WITs] using command prompt.
Follow the procedures as given in Microsoft Site.
https://learn.microsoft.com/en-us/vsts/work/customize/reference/witadmin/witadmin-import-export-manage-wits?view=tfs-2018

tfpt.exe on Visual Studio 2017

Even after installing Productivity Power Tools extension for Visual Studio 2017 I still cannot run tfpt.exe to execute the command suggested on this post:
C:\Development> tfpt unshelve "ShevesetName;UserName" /migrate /source:"$/Project/Source" /target:"$/Project/Target"
Where can I find this program?
The Productivity Power Tools are not the same thing as the TFS Power Tools, so that's why installing it didn't help.
There is no set of TFS 2017 Power Tools. From the TFS 2017 release notes:
Issue: No Power Tools have been released for TFS 2017.
Workaround: We are excited to let you know that most of the previous
Power Tools have been integrated into TFS 2017. The Process Template
Editor is one that has not been integrated, but we are going to
publish a Process Template Editor tool for TFS 2017 to the Visual
Studio Gallery shortly after TFS 2017 is available. We will provide
the link here as soon as it’s published
Just as Daniel said, they are two entirely different things. A supplement :TFS 2017 Process Template Editor is available
In your case, you are trying to use the unshelve command to unshelve a shelveset to another branch in TFS. As a workaround you could use tf Unshelve and Rename command to achieve this in two steps.
Or just install a earlier version VS and Power Tools such as VS2015 and Microsoft Visual Studio Team Foundation Server 2015 Power Tools. After all you just need to match the version of the TFS Power Tools with your Visual Studio client.
Possible workaround, which helped me!
Create a new workspace and do not download all the files.
Unshelve your changes to this new workspace, which would result in having only the modified files from your current branch.
Compare and manually merge your changes into the other branch.
You can use this VisualStudio extension witch does exacly what you want:
MultiMerge - https://marketplace.visualstudio.com/items?itemName=Jesusfan.MultiMerge2022
This extension allow you to unshelve to other branch.
You can use git-tfs to accomplish this. The steps you should perform are (after git and git-tfs have been installed):
create a git branch from the shelveset (git_branch_a).
initialize a git branch (git_branch_b) based on the TFS target branch (tfs_branch_b).
merge the git_branch_a into git_branch_b.
based on the git_branch_b create a shelveset.
the new shelveset can now be unshelved in the tfs_branch_b.

Using TFS 2015 Build to build projects in TFS 2013

We currently use TFS 2013.
I'd like to do a POC where I can create some build definitions in TFS 2015 where it would get the source from our existing TFS 2013 server. Once the boss sees how much easier it is to manage our builds from TFS 2015, I'm sure he'll give us the go-ahead with upgrading the existing TFS 2013 to TFS 2015.
Is this even possible?
You could write a PowerShell script or some batch files to leverage tf.exe in order to map a workspace / clone a repo (depending on whether you're using TFVC or Git) as part of a build. Or just put the tip of your source code into the "demo" environment and build from there. The latter option is going to be much faster.

Why does "tf history ." claim there is no working folder in my mapped TFS directory?

I am trying to modify my project so that on build it queries for the current TFS changeset for the local directory and uses that to form the build number (using http://florent.clairambault.fr/insert-svn-version-and-build-number-in-your-c-assemblyinfo-file as a reference).
Since we currently are not using team build or any continuous integration for this particular project at this time I plan to use:
tf history . /r /noprompt /stopafter:1 /version:W
However, when I test this command out using the visual studio command prompt in my project's directly (where I work from TFS) it claims:
There is no working folder mapping for xxxxxxxx
The folder is shown as mapped in my workspaces in Visual Studio's Source Control Explorer (shows as the local path), and when I edit my workspace.
Why is the command line utility claiming there is no working folder when it is?
You will see this error message if you are using Visual Studio 2012 (and the corresponding Team Explorer 2012 client) and you are using tf.exe from Team Explorer 2010.
TFS 2010 clients store their local workspace cache in a different location on-disk than TFS 2012 clients. Thus, if you are to create a workspace with a TFS 2012 client, the TFS 2010 client cannot see that workspace data until it has connected to the server and populated its own local client cache.
It sounds like you're okay with using the TFS 2012 version of tf.exe, so I would make sure that your PATH contains an entry to that one first, and this should resolve your problem.
If you really wanted interoperability between the two versions, you would need to make sure to connect to your TFS server from both clients in order to make sure the workspace cache was complete for both. However make sure that you are using only server workspaces in this case, as TFS 2010 cannot connect to a TFS 2012 local workspace.

How to get tf.exe (TFS command line client)?

What's the minimum amount of software I need to install to get the 'tf.exe' program?
You need to install Team Explorer, it's best to install the version of Team Explorer that matches the version of TFS you are using e.g. if you're using TFS 2010 then install Team Explorer 2010.
2012 version http://www.microsoft.com/en-gb/download/details.aspx?id=30656
2013 version http://www.microsoft.com/en-us/download/details.aspx?id=40776
2019 version https://visualstudio.microsoft.com/downloads/#visual-studio-team-explorer-2019
You also might be interested in the TFS power tools. They add some extra command line features (using tfpt.exe) and also add some extra IDE features.
I'm in a virtual machine, and am trying to keep my VHD as small as possible, so I find Team Explorer is a really heavyweight solution (300+ MB install). As an alternative, I've had some luck copying a minimal set of EXEs/DLLs from a Team Explorer installation to a clean machine (.NET 4.0 is still required, of course).
I've only tried a handful of operations so far, but this set of files (about 8.5 MB) has been enough to get basic source-control functionality via tf.exe:
TF.exe
TF.exe.config
Microsoft.TeamFoundation.dll
Microsoft.TeamFoundation.Client.dll
Microsoft.TeamFoundation.Common.dll
Microsoft.TeamFoundation.Common.Library.dll
Microsoft.TeamFoundation.VersionControl.Client.dll
Microsoft.TeamFoundation.VersionControl.Common.dll
Microsoft.TeamFoundation.VersionControl.Controls.dll
(It should go without saying that this is a completely unsupported solution, and it doesn't free you from the normal TFS licensing requirements.)
Depending on the operations you perform, you may find that additional DLLs are required. Fortunately, tf.exe will produce a nice error message telling you exactly which ones are missing.
For Visual Studio 2017 & 2019, it can be found here :
-Replace {YEAR} by the appropriate year ("2017", "2019").
-Replace {EDITION} by the appropriate edition name ("Enterprise", "Professional", or "Community")
C:\Program Files (x86)\Microsoft Visual Studio\{YEAR}\{EDITION}\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe
For Visual Studio 2022, it can be found here :
C:\Program Files\Microsoft Visual Studio\2022\{EDITION}\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe
There is a Java TFS client in the Team Explorer Everywhere installation (together with an Eclipse plugin). Look at http://www.microsoft.com/en-us/download/details.aspx?id=30661
For reference: these are the required DLLs for Visual Studio 2017 (as did #ijprest for the VS 2010)
TF.exe
TF.exe.config
Microsoft.TeamFoundation.Client.dll
Microsoft.TeamFoundation.Common.dll
Microsoft.TeamFoundation.Core.WebApi.dll
Microsoft.TeamFoundation.VersionControl.Client.dll
Microsoft.TeamFoundation.VersionControl.Common.dll
Microsoft.TeamFoundation.VersionControl.Controls.dll
Microsoft.VisualStudio.Services.Client.Interactive.dll
Microsoft.VisualStudio.Services.Common.dll
Microsoft.VisualStudio.Services.WebApi.dll
They will be in my base VM image. I'm going to use it to pull the latest deployment scripts from VC to a temporary local workspace folder when installing a new server.
tf workspace /new ...
tf workfold /map ...
tf get "%WorkSpaceLocalFolder%" /recursive
tf workfold /unmap
tf workspace /delete
<run deployment scripts from "%WorkSpaceLocalFolder%" >
rmdir "%WorkSpaceLocalFolder%"
(Sorry to post this as an answer, but I don't have enough reputation to comment, which I believe it should have been)
The tf.exe command line is included in the VSTS agent package in folder externals\vstsom.
You can also try TFS CLI for Node.js which is a cross-platform CLI for Microsoft Team Foundation Server and Visual Studio Team Services.
Visual Studio 2017 Team Explorer
According to https://blogs.msdn.microsoft.com/bharry/2017/04/05/team-explorer-for-tfs-2017/ you can now download it separately from Visual Studio via this link:
https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=TeamExplorer&rel=15
Following on from the earlier answers above but based on a VS 2019 install ;
I needed to run "tf git permission" commands, and copied the following files from:
C:\Program Files (x86)\Microsoft Visual Studio\2019\TeamExplorer\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer
Microsoft.TeamFoundation.Client.dll
Microsoft.TeamFoundation.Common.dll
Microsoft.TeamFoundation.Core.WebApi.dll
Microsoft.TeamFoundation.Diff.dll
Microsoft.TeamFoundation.Git.Client.dll
Microsoft.TeamFoundation.Git.Contracts.dll
Microsoft.TeamFoundation.Git.Controls.dll
Microsoft.TeamFoundation.Git.CoreServices.dll
Microsoft.TeamFoundation.Git.dll
Microsoft.TeamFoundation.Git.Graph.dll
Microsoft.TeamFoundation.Git.HostingProvider.AzureDevOps.dll
Microsoft.TeamFoundation.Git.HostingProvider.GitHub.dll
Microsoft.TeamFoundation.Git.HostingProvider.GitHub.imagemanifest
Microsoft.TeamFoundation.Git.Provider.dll
Microsoft.TeamFoundation.SourceControl.WebApi.dll
Microsoft.TeamFoundation.VersionControl.Client.dll
Microsoft.TeamFoundation.VersionControl.Common.dll
Microsoft.TeamFoundation.VersionControl.Common.Integration.dll
Microsoft.TeamFoundation.VersionControl.Controls.dll
Microsoft.VisualStudio.Services.Client.Interactive.dll
Microsoft.VisualStudio.Services.Common.dll
Microsoft.VisualStudio.Services.WebApi.dll
TF.exe
TF.exe.config

Resources