What I'm trying to do should be simple - I want to get information for a single TFS workspace (in this case named the same as the computer name), and have that information returned via text - not via prompt window (it's my understanding this is what the /noprompt option is for). I am using the "workspace" command, and according to the official documentation (https://learn.microsoft.com/en-us/vsts/tfvc/workspace-command), it's not 100% clear this is supported.
Note:
I have tf.exe from Visual Studio 2017 and 2015 installed, and the 2015 Power Tools, but am preferring the 2017 client.
I've read the TF Workspaces question, and view this as something else - I specifically want the information about a single workspace (for a PowerShell script).
The /noprompt option of tf.exe don't allow you to view details.
It allows you to create a new workspace or edit existing one, without the dialog.
You can use the tfs client object model to query local workspaces. You can get the local workspaces through the workstation object https://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.workstation(v=vs.120).aspx
And you can use the version control server object to query additional details, fetch files, change the mapping etc https://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.versioncontrolserver(v=vs.120).aspx
This blog explains how to load the right assemblies, it references the 12.0 object model, I'd reccomend using the latest nuget packages instead. https://www.google.nl/amp/s/alistairbmackay.wordpress.com/2016/02/01/manipulating-tfs-with-powershell-part-1-connecting/amp/
Latest object model:
https://www.nuget.org/packages/Microsoft.TeamFoundationServer.ExtendedClient/
Related
I migrated TFS from an old server "OLDMACHINE" to a newone "NEWMACHINE". TFS is shutted down on OLDMACHINE. Now I want to update my different URLs on developpers computers.
For my git clones, the command is :
git remote set-url origin https://NEWMACHINE/...
I don't find the corresponding command with tf workspaces. I've search in the Visual Studio's window Workspaces..., but I can't open it anymore because my old TFS is down.
The next command show me my workspaces :
tf workspaces
Is it possible to update the URL with
tf workspace ?
There are many documentations about renaming computer, moved folder, username, but I didn't find any in my direction.
EDIT :
I found this key in regedit, with subkeys. I want to give it a try, has anyone ever done this manipulation?
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0 or 14.0\TeamFoundation\Instances\OLDMACHINE
There is no this kind of related command for TFVC. Each TFS server has a unique identifier(GUIDs) that is used to represent each collection and is not dependent on the server "name." The upgrade/migration does not modify the TFS GUIDs.
For that reason, all end-users have to do is connect to the TFS server via Visual Studio and can resume work, including any pending changes. No need to update the "collection name" for their local workspace.
Besides, if you have problems with workspaces, TFS Sidekicks is a really useful tool because it gives you a nice GUI tool to list, check, delete and manage all workspaces defined in your TFS. (Need Administrative privilege)
The TFS add-in for Eclipse doesn't automatically check out files when you edit them, and you get this annoying and misleading error message when you go to save:
Mathematica could not write some data to the file
C:\Dev\ProjectName\Main\Mathematica\ExcelImport.nb. You should check
that file's permissions.
I've looked up a couple of threads:
http://team-foundation-server.blogspot.com.au/2007/06/automatic-checkouts-with-team-explorer.html
TEE 2012 does not check out files automatically
what's the best way to checkout from TFS to eclipse using TEE?
But in my case we're using it for Mathematica projects and they have the Team menu but they do not have the select Share, then select TFS
Hopefully someone out there knows a workaround, we are using Juno with TFS2010 (cough #EdwardThomson)
If you're using TFS 2012 you can create a local workspace rather then a server workspace.
Local workspaces work in a similar way to SVN and there is no need to check out files to edit them
We're using Team Foundation Service instead of a local TFS.
Our solution was created on Visual Studio 2012.
My problem is now that we want all assemblies to have the same version number (this part is already solved by using a CommonAssemblyInfo.cs that is linked into all projects).
The issue I'm facing right now is that we need the tfs changeset number at the last digit of the assembly version (e.g. 1.0.0.4711 where 4711 is the changeset number).
I've found several examples, but none of them worked for me.
And yes, I especially searched here on stackoverflow a lot.
I also have to admit that I've never looked into the MSBuild scripts...
Can anyone please give me a hint on how to accomplish this?
Is it for example possible to use the MSBuild Extension Pack on Team Foundation Service (not local TFS) and if, how to do that?
As always, time is my worst enemy...
Note that from 2010 Tfs employs Windows workflow for building the package the workflow calls msbuild for compiling the projects only - while its possible to pass changeset this way to msbuild its rather more hops.
Following deals with your problem, however the linked solution is more complex that needed:
Can assembly version been automatically updated with each TFS 2010 Build?
This is one of best series of tutorials on the custom build activities, the author is on stack as well i believe, one specificly about versioning
http://www.ewaldhofman.nl/post/2010/05/13/Customize-Team-Build-2010-e28093-Part-5-Increase-AssemblyVersion.aspx
In short you need a custom activity to run before compilation on source files, find all CommonAssemblyInfo.cs files, feed this list to your custom activity, it modifies the values inside with passed value of full version number or only the changeset and optionaly check in the change (probably not since your changeset will be out of sync then).
You can also take a look at https://tfsbuildextensions.codeplex.com/ set of activities there is TfsVersion activity among them, at the very least it will provide examples.
Functionality need for this should be available through Team Explorer and source control - The Custom activity assemblies and build templates usually are located in folder in your team project root - the location of this folder is defined for build controller you can change this through team explorer build section.
Changeset is available from value BuildDetail.SourceGetVersion, not sure if this was fixed/changed in 2012 however there were 2 issues about this value in 2010
Its doesnt respect GetVersion override in default build template - you will manualy need to update if override is used
When running latest build (no override) it will get the last changeset number from tfs - depending on your branches this may not be the same as 'last' changeset for the branch of build. You will either have to live with this, provide overrides for each build or implement activity that checks branch history for last changeset value and overrides it again.
It should be noted that GetVersion should be able to accept any sourcespec version - changeset, date, label etc. I havent played around with this enough to provide more details to you.
Colin Dembovsky wrote a great overview of doing version embedding using the new pre-build script setting in TFS 2013 build definitions.
The Changeset number is easily accessible within the pre-build process in the environment variable TF_BUILD_SOURCEGETVERSION. I was able to use this to embed the Changeset value in our binaries using a script based on Dembovsky's work above. (I used Perl, not powershell, so you probably don't want to see it ;-)
This approach doesn't require any changes to the build workflow which makes it a big win for me.
I've used Wintellect's solution - MSBuild-only, no TFS magic needed. I also added to the auto-generated CSharp file:
[assembly:AssemblyInformationalVersion("$(BuildNumber)")]
So I get the TFS build number.
Currently, our DBAs require the TFS changeset number for any scripts/stored procedures/functions that need to get deployed. I have a folder in our TFS project with all of my stored procedures in it, and I'd like to run a single query that will list each object in that folder and the latest changeset. I'm using VS2010 Team Explorer with TFS Server 2008 (I believe), and would be happy to script it in PowerShell or some other tool, but don't know where to begin. Can someone provide me some direction?
TFS has a lot of extensibility points that make running a query like this possible. If it were me, I'd simply use the tf.exe command-line client. For example:
tf properties $/Path/To/Folder -recursive
This will show you the latest changeset for each of the files beneath the given folder (as well as other information.)
While the output from the command-line client is well-formed and easily parseable, you may still prefer a more programmatic way to do it. You can use the very powerful .NET API in order to query from the server. You'll want to call the VersionControlServer.GetItems method. For example:
ItemSet items = vcs.GetItems(#"$/Path/To/Folder", RecursionType.Full);
If you haven't yet, you should take a look at the TFS 2008 Power Tools, which include the TFS Power Shell Extensions. My powershell-fu is weak, but I think that the above in Power Shell works out to be something like:
$tfs = get-tfs http://yourserver:8080/tfs/YourCollection
$tfs.VCS.GetItems('$/Path/To/Folder', $tfs.RecursionType::Full)
When using TFS with a tool outside of Visual Studio (Specifially ORMS), modifications to the project file to include a new file will not cause the file to be added to source control.
Does anything exist that could potentially say "Warning: You are about to check in change to a project file which include a file which is not versioned"
In addition to Martin's answer, the latest release of TFS Power Toys includes:
"Windows Shell Extension (NEW!)
Allows core version control operations within Windows Explorer without using Team Explorer."
So you may just be able to commit those new files without having to fire up Team Explorer or use an MSSCCI compliant source control client.
Not quite, however you might want to download the TFS Power Tools and check out the command line utility tfpt.exe.
The "tfpt online" and "tfpt treeclean" might be most useful to you when working outside of an integrated TFS client. tfpt online will look for files in your local directory that are not under version control, treeclean will show you files in your local directory that are not under version control so that you can remove then if they are not required.
Good luck,
Martin.
One gotcha I've found using tfpt online is that it doesn't always pick up changes unless you use the /diff switch. That one caused us all kinds of headaches with our automated build until I realised what was happening!