Thursday, November 20, 2014

Setting up a client trace with TFS 2013

Users may report performance issues with Team Foundation Version Control. Sometimes it may be something the TFS client is doing or sometimes it may be the server side.  I have seen a post around source control permissions causing the issue.  This is unlikely the cause in my case because the user was able to work around the slowness by converting their workspaces to server workspace's and then back to local.  I am trying to figure out what is causing this and came across this post regarding TFS Client Tracing.  With a few tweaks I was able to get it to work with Visual Studio 2013 Update 4.

Below is an updated version for Visual Studio 2013.

  1. Shut down Visual Studio
  2. Using Windows Explorer navigate to the following directory (my install was in Program Files (x86) directory):
    C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE
  3. Make a backup copy of the devenv.exe.config
  4. Edit devenv.exe.config by adding the following before the last </configuration> :
<system.diagnostics>
<switches>
<add name="TeamFoundationSoapProxy" value="4" />
<add name="VersionControl" value="4" />
</switches>
<trace autoflush="true" indentsize="3">
<listeners>
<add name="myListener" type="Microsoft.TeamFoundation.TeamFoundationTextWriterTraceListener,Microsoft.TeamFoundation.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" initializeData="c:\tf.log" />
<add name="perfListener" type="Microsoft.TeamFoundation.Client.PerfTraceListener,Microsoft.TeamFoundation.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</listeners>
</trace>
</system.diagnostics>

  1. Trace data will be written to "c:\tf.log (blold above).  Change this file name if you prefer
  2. Save the file
  3. Start Visual Studio
  4. Run steps you are interested in tracing
  5. Open c:\tf.log or the file you specified it in step 5
  6. This writes a lot of data so you will want to restore to the original setting when finished by copying the original devenv.exe.config file back or commenting out the lines in step 4 by surrounding the lines with <!-- and --> .

Tuesday, November 4, 2014

Switching Workspace Location on a Mac

vswhitelogoOne of our developers is doing development on a Mac.  The user has TEE (Team Explorer Everywhere) plug-in installed for Eclipse.  The user initially created a server workspace and wanted to switch it to a local workspace.  Unfortunately when doing that in the UI it did not work and gave a permission denied error.  How to fix that?

As luck would have it they did not take a screenshot of the error and I didn’t want to bug him too much to recreate it.  Developers at my company are very busy and they need time to focus (so I minimize disruptions to them). 

Looking at the file in question we could see that it had these permissions

--r—r—r root staff

Our best guess is the Eclipse UI did not have enough rights to alter the permissions on the file.  Upon doing some research there is no command line option to alter the location to local using the tf workfold nor the tf workspace commands.  The only time you can set this on the command line is when creating a NEW workspace.

So my final recommendation to this poor soul was to have 2 workspaces.  One server workspace for managing (branch/merge) whole branches and create a second workspace that is local.  The day to day work on his cards would be done there.

One note I have asked him to run Eclipse with sudo so we will see if that works.  I will update the post if I hear good news.

Thursday, October 30, 2014

Cleaning A TFS Workspace

This option doesn’t clean files not under source control that may live in your workspace.  It also doesn’t undo checkouts.

  • Get specific Version…

clip_image001

  • Check the first box for overwriting writable files
  • If you check the second checkbox as well it will download everything

clip_image002

There are other Powertools commands to clean your workspace. Be careful with these as they may delete items you don't have under source control.

  • tfpt scorch – Ensure source control and the local disk are identical
  • tfpt treeclean – Delete files and folders not under version control
del.icio.us Tags: ,

Monday, October 27, 2014

Exception System.IO.FileLoadException, Exception thrown executing tests

We are in the process of moving from CuiseControl.NET and NAnt into TFSBuild.  One of the .NET solutions I was prototyping kept giving me a generic error message when it tried to run the NUnit tests we have.

The message was…

Exception System.IO.FileLoadException, Exception thrown executing tests mytest.dll

Took me a few days but finally came across a post that got me thinking.  Some of our references are fully signed.  So that means the test which is unsigned is trying to call some signed assemblies to execute. 

I first enabled verification skipping on the build machine (see the SN help for this).  That worked and it was able to execute NUnit tests.  But I don’t want that enabled on my build machine.  Having that could result in files not getting signed and deployed.  This would result in runtime errors in our environments.

The solution is to add a line similar to this on the MSBuild arguments (under Advanced) for your build definitions.  It will look something like this:

/p:SignAssembly=true,DelaySign=false,AssemblyOriginatorKeyFile=..\..\Global\MyPrivateKey.snk

 

del.icio.us Tags: ,

Wednesday, October 22, 2014

Deleting a Branch or Folder in TFS Without Getting The Whole Branch in Your Workspace

imageOne of our teams has a rather large branch consisting of some 53k files.  Using one of the IDE’s it requires you to have the latest of the branch before the Delete option will no longer be grayed out.  This results in frustration by the team as they regularly delete feature branches after it has been merged to their Integration branch.  There does not seem to be a way in Visual Studio 2013 to not do a recursive get latest.

Did some searching on the internet and Stackoverflow.com had some answers with very short ways of what I am about to show.  I felt some more detail might help others out there searching for speed.

The first thing you need to do is open a command prompt where the tf.exe command is accessible (or you will need to type the full path to it each command).  Mine is found in C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE.  This is in my PATH but I am not sure if Visual Studio put it there or if I did. 

  1. From the command line go to the folder above the branch you want to delete using CD pathname
  2. In my example I am deleting the Int branch.  So we need to get just that object.  Type in tf get branchname (Ex: tf get Int).  This also got the immediate children into my workspace as well.  Not so bad as getting the entire branch.  The command line has a recursive option if you want to get the whole thing.
  3. Now we delete the branch with a tf delete $/TFS/Path/To/The/Branch  (Ex: Tf delete $/TheMaster/Branches/Unmanaged/sandbox/mrainey/Int)  You can see in my picture above only the branch has a red X on it. 
  4. Last but not least submit the pending changes.  I did this in Visual Studio so I could verify what was in my list of things to check in.  the only thing listed was the branch so it was a simple check in option. 

So just the branch was deleted and none of the children folders/files remain either.  Very clean and quick.

del.icio.us Tags: ,

Thursday, October 9, 2014

TFS PowerShell Script to find and delete files

 

Here is a quick script to find a certain file or file type.  Get latest on it and then mark it for delete.  You will need to review your pending changes to make sure the correct files are being deleted and then manual check the change in.  Enjoy!  I am still playing around with code snippets in my blog so I apologize for word wraps and other bad formatting.

#Script to Find and delete files based on their extension
#
You must be in your local workspace folder when executing this script

if ((Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue
}

$tfs=Get-TFSServer http://tfs.yourdomain.com/tfs/yourcollection
$TFSToolsPath
= "${Env:PROGRAMFILES(x86)}\Microsoft Visual Studio 12.0\Common7\IDE"
Write-Host $TFSToolsPath

$CleanUpList = Get-TfsChildItem -Server $tfs -Recurse $/yourteamproject/*.suo
foreach($file in $CleanUpList){
Write-Host $file.ServerItem -ForegroundColor Cyan
#Get Latest On Each Item
tf get $file.ServerItem
#Delete Each item
tf delete /lock:checkout $file.ServerItem
}

Wednesday, September 24, 2014

TFS Query–Tasks Completed Yesterday

Sometimes boards get allot of cards on it and during your standup it may be hard to remember what you did yesterday.  That done column gets pretty big even for smaller sprints when teams create a hundred tasks.  I did not see this query in the default set.  It was easy as it is just one new clause added on to the existing Completed Tasks query. 

Just add the following clause:

And Closed Date = @Today – 1

image

del.icio.us Tags: ,