Thursday, December 18, 2014

TFS Work Item Recycle Bin

Sometimes end users create test cards (stories or tasks) or cards are no longer needed.  Story or feature cards there is no removed state.  This only exists at the task level.  This can result in some inaccurate reporting or bad queries if your not careful.  Plus as an administrator I don’t want to be constantly destroying test cards.

Windows and other applications have a recycle bin.  So why not TFS?  To solve for this an Area and Iteration Path called Recycle Bin was created.  Now we can set any standard queries or reports to always exclude that iteration & area.

image

del.icio.us Tags: ,

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: ,

Wednesday, September 17, 2014

OneNote 2013 Crashing on Sync

This morning my OneNote was crashing and giving the message that is has stopped working.  The only options are to Debug or Close the program.  Restarting didn’t help and I noticed it kept crashing when it was trying to sync a specific notebook

image

This notebook is in our SharePoint so I did a quick search and found a KB from Microsoft called KB2737968.  There was a forum post with a link to it which fit my circumstances.  Make sure you pick the correct one to download and run based on whether or not you installed the 32-bit or 64-bit version of office.  It will also ask you to shut down any Office applications you may have open.

image

The article also suggests applying an Office 2013 updates that are available.

After applying this and doing a reboot OneNote now stays up.  It was able to sync the notebook in question.  One thing is a password protected section was added to the Notebook.  I just found out about that and am wondering if that was the culprit.

del.icio.us Tags: ,,

Tuesday, September 9, 2014

Planning with Iterations

imageOne of the things some of the teams would like to start using is the planning feature in TFS.  This feature is enabled on the Stories backlog.  Over on the right there is the Forecast option.  Just turn this on and set the velocity to your teams.  Currently this is a manual task and you will need to determine what velocity to use (last sprint, an average, etc.)
image
Once this is set you will see a line break with the iteration in the backlog.  This is useful for your planning meetings as well as forecasting how many iterations will be needed to complete a feature (all user stories done).
The question that our team had was how many iterations do you make visible/available for planning into the future? Initially I thought having to many future iterations would clutter things so I created them but did not make them visible.  Unfortunately this does not help the end user as those iterations don’t show up for planning purposes.
image
Going back into the admin page for the team I then selected all of the iterations I had created.  Thus making them visible for planning.  Now we can see all of the iterations and the team was able to forecast how many until this epic would complete.
image
Currently we are going to try out 2 week sprints and see how that goes.  I have read others doing three weeks but as a friend told me it is much easier to think about what you can get done this week and next.  This keeps things focused and easier to manager.  We will see.  Thanks for reading.
Are you able to plan out 2 weeks ahead what your going to do?

del.icio.us Tags: ,

Friday, August 8, 2014

SQL Server Reporting Services Permissions for TFS 2013

SQL Server Reporting Services (SSRS) Setup
Some teams would like to be able to create and upload their own reports.  Following a similar approach for multiple teams in one collection/team project approach a folder called _Teams under the team project folder was created.

Under the team folder will be folders for each team who want custom reports.  The permissions Microsoft says to grant are admin level permissions.  Because of this they will be restricted to SG.TFSTeamAdministrators security group.  The rest of the team will still be able to view the reports.  This is done ONCE on the _Teams folder.  No further action is required to maintain this.
 


Report Builder Setup
The Report Builder button was not showing up for the users.  After further research a Microsoft article was found that had some basic setup information in it.  I was hesitant at first but after seeing other posts about the missing button I pulled the trigger and created a new role assignment at the system level.  It grants System User to all of the collections users.  We have an AD group for this so that was used.  This was granted in the report manager application as well by clicking on the Site Settings in the upper right corner and going to the security section.



This was probably an omission in the TFS Setup instructions because it is custom and not needed for TFS to publish reports (no need for Report Builder). 

SQL Server Analysis Services Setup
The next step is granting permissions for SQL Server Analysis Server.  The Microsoft article written for TFS 2013 details the permissions needed for both the relational data warehouse and analysis cube.  Because this grants permissions at a collection level, it will be restricted to a security group you have created that contains all of the team administrators for TFS.
  • For the database you will need to create the login for the group at the instance level and then assign it the roles on the Tfs_Warehosue database.
     
  • Make sure when adding a group to check the box for searching those objects.  It is not checked by default.  his tip applies to the database and the cub (Analysis Services) permissions.


Thursday, August 7, 2014

Update Other Users Profile Picture in TFS 2013

As TFS administrators we have been contemplating how to change profile pictures for those who choose not to upload one.  Team and person identity is important in building a strong team.  There is no active directory integration yet for setting these automatically so after some digging an existing solution was found.


One thing not mentioned in the article is that you must have Visual Studio or Team Explorer 2012 installed or you will get Could not load file or assembly 'Microsoft.TeamFoundation.Client, Version=11.0.0.0…


The site mentions recycling app pools or rebooting the application servers.  Since this is production that would have to go through the change management process.  That did not have to be done as our picture changes updated right away with a (ctrl-f5.)

Monday, August 4, 2014

Team Explorer Everywhere on MAC

Setup Team Explorer Everywhere 2013
We have a build server for Apple applications.  This will need to switch over to TFS as part of the migration from SVN to TFS 2013.  Microsoft (MS) does make interaction with Team Foundation Server (TFS) possible through the use of Microsoft Team Explorer Everywhere 2013 (TEE).  It can be downloaded here.  One thing to note is this is a command line utility.  There is no GUI for it unless you install Eclipse and then the TFS plug-in for Eclipse.

The install documentation is very lax and consists of 3 basic steps.

To install the Cross-Platform Command-Line Client for Team Foundation Server
  1. Unzip the archive (TEE-CLC-12.0.0.zip file) that contains the client.
  2. Configure your shell or system path to include the folder to which you unzipped the archive.
  3. To verify that the client is working, at a command prompt, type tf, and then press the ENTER key.

I believe MS assumes you know the OS in detail.  However this is not always the case (I know nothing about MAC X).  Below are the steps I followed to get the utility running for all users.  I do have prior knowledge of Unix command line which helped me get through this.

  1. Download and unzip to a location on the MAC.  In my case this was to the Dumps share (Unzipped from Windows to the MAC share).
  2. Log into the MAC build server as an administrator (or someone with SUDO permissions.)
  3. Since I unzipped the folder as my Windows user the MAC user did not even have writes to read the folder contents.  Grant Everyone read by overwriting the MAC permissions in Finder
  4. On the MAC build server open the command line console.
  5. So that all users have access to TEE we will copy the folder a common location.   Use the cp command to accomplish this.
    cd /usr/local
    sudo cp -R /dumps/TEE-CLC-12.0.1 .
You should get a prompt for your password.  If you do not have sudo rights you will not be able to execute this command.

  1. Edit the system path for MACs to include this new folder in searching for commands.
    sudo nano /etc/paths
  2. Add a new line at the end of the file that has /usr/local/TEE-CLC-12.0.1
  3. Save and close the file (Ctrl-X and Yes)
  4. You will not be able to run the tf command until permissions are granted to all users.
    cd /usr/local/TEE-CLC-12.0.1
    sudo chmod 755 tf
  5. Close and reopen a new terminal to apply the path changes
  6. Type in tf.  Now you should get the help information for the file if the path and application are setup properly.

Thursday, July 31, 2014

Adding TFS 2013 User Story Points field in Microsoft Project

Although we are an agile shop we still have a few managers who like to use Microsoft Project.  There is no project server setup to integrate with Team Foundation Server.  As of now the manager would like to export from TFS into MS Project, update, and import back in.  

Once the data is in project he will setup dependencies and other linking project managers like to do.  With the goal of producing a Gantt chart to help with dates.  They already have this by working with the velocity and burn down charts so I believe the main benefit is the setting up of task dependencies and making those visible.  I haven't found a good way to do this in TFS yet (sibling links don't stop you from completing a task before a dependency.)

Project uses field mappings between TFS and itself to define what fields show up in Project and which are editable.  One of the fields the project manager wanted to be able to update is StoryPoints.  As luck would have it this is not one of the default fields that show up.

This Microsoft article gives some explanation to the TFSFieldMapping file and how to download and upload it to TFS.

I followed the documentation and went with the advice of the project manager to add the field as ProjectField="pjTaskText20".  I learned a few things by doing this.  When trying to upload I got this message:

TF233004: You must install Office Primary Interop Assemblies (PIA) in order for Team Foundation Server to validate the Office Project Field Mapping file prior to upload. To install PIA, go to the Microsoft Web site: http://go.microsoft.com/fwlink/?LinkId=168855.

I went to Microsoft's site and found the Microsoft Office 2010: Primary Interop Assemblies Redistributable.  After installing this I got the same message.  The internet certainly makes work easier.  After some searching I found a post that says this doesn't work.  What you really need to do is install MS Project.  Hopefully for the reader you have this available to you.

On the next upload attempt I did get a little further.
Connecting...
Validating...
TF233003: Cannot upload the specified file as it either contains invalid elements or the elements are not in the correct sequence. Correct the Team Foundation Server Field Mapping file and try again.
Error detail:
TF234001: Work item field Microsoft.VSTS.Scheduling.StoryPoints is mapped to the wrong field type in Microsoft Project. You can map work item fields of type Double only to Project Cost, Duration, Work, and Number fields. Map the work item field to a Microsoft Project field of type Double.

Again I turned to the internet and found a better article.   What I needed was to define it as a Number (I guess that suffices for type Double.)
Columns displayed in Project depend on the predefined TFS - MS Project work item field mapping. To make Story Points show up in MS Project, you have to customize the Project-TFS mapping file since Story Points are not mapped to a Project field by default.
1. From the VS Command Prompt, run "TFSFieldMapping download" command to get the mapping file locally.
2. Add a new entry to the file to map your Story Points field to an MS Project field (pjTaskNumberx)
3. From the VS Command Prompt, run "TFSFieldMapping upload" command to push the mapping file back to the TFS Server.


This worked like a charm.  Below is the command I used for the download and what the tfsfieldmappingfile looks like with my addition.  As always you should keep a copy of the original field mapping file (in TFS) and check in any changes to it.

I hope this helps you in your quest to be the best TFS admin that ever walked the earth!

From C:\Program Files\Common Files\Microsoft Shared\Team Foundation Server\12.0 I ran:


tfsfieldmapping download /collection:http://tfs/tfs/mycollection/teamproject:myteamproject/mappingfile:C:\WS\TFS\myteamproject\myTFSworkspaceSoICanKeepTrackOfMyChanges\TFSConfig\tfsfieldmappingfile.txt


Wednesday, July 23, 2014

Visual Source Safe migration to Team Foundation Server 2013

Below are some of the steps and the process behind migrating our ancient Visual Source Safe repository into TFS 2013.  Hopefully this will shed some light on things to think about before and during the conversion.

The first thing was to get my hands on the VSS Migration Wizard.  This was out on Microsoft's website. 
This tool recommends having it local to the server where the VSS repository is located.  What I decided to do is spin up a virtual machine with SQL for this migration task.  Note that for large VSS repositories you may need SQL Standard or higher and not SQL Express.

Our VSS database was on a network file share.  This is the typically setup for VSS.  To get it to migrate quickly I used Robocopy to copy the whole structure to the VM where the migration tool was installed.  This not only gets it local (like the wizard wants it) but it also preserves the original VSS repo.  The only thing I changed in the SourceSafe config file was the location of the log file.  The log variable was still pointing to the network share.  After that I was able to log in with no issues.

The preservation was needed because A) it hasn't had analyze run on it in years and B)it was on a version of VSS not supported by the wizard.  I figured out the second part by running the wizard and having it verify things for me.   We were on 6.0 but I think it needs to be 6.0 c or d or higher for it to work.

The next step was getting past the verification.  Luckily someone had placed the Visual SourceSafe 2005 ISO out on our network.  That was a life saver as it is very hard to find old Microsoft releases.  This I installed on the migration VM where the copy of VSS repository lived.  I followed the VSS 2005 upgrade instructions included with the media to get the copied repository upgraded.

With the upgrade done the wizard worked like a charm.  I did setup a new TFS team project just for this repo.  The wizard took about 7 hours for our 2 GB VSS repository.  There were 73 file conversion errors.  They were all listed in the log.  Upon looking at one of the files that erred in TFS it was just a 0 byte file but it did exist.  The VSS file I was able to get with no issues and placed it on the tip in TFS.  That will have to work as I can get through these files quicker than trying to figure out the issue and resolving it.

Some of the other issues it ran into was files that were checked in with the 8.3 DOS file format/length restriction.  There is a Microsoft documented workaround the migration log points you at to resolve this.  For me it was files that were accidentally checked in (like log files) that were not needed.

This conversion was just to preserve it for historical purposes.  I am not actually building anything from it so having a few errors is OK.  I have all of the valid files in SVN right now which I will be converting to TFS soon.


If you have any VSS to TFS stories to share let me know.  I am always curious as to what others have done.

Monday, July 7, 2014

TFS 2013 Merge Tips

We did our first team merge last week.  There were several things we learned about doing merges of your whole branch.  Below are some of the learning's and any helpful links we came across for our next merge.

White-space

At some point one of the developers ran an application that reformatted the code.  In doing so it removed extra white-space in various places.  This caused a large number of files to not automatically resolve and where presented as conflicts.  We are not sure why but since the white-space was different on both branches this flagged the file.

This article found on stackoverflow.com was detailed enough to show us how to get around this however the code would be different between trunk and the branch.  The right thing to do would be determine which format was correct and accept the files on that branch.  In our case it was the source branch so we went through the several hundred files and accepted source version for those.

Ignoring Folders

There is folder we call Global that has files global to all solutions (files in the folder are references by each solution or project).  There are also build scripts in it managed by my team.  We do not want the developers to attempt to merge these folders without my team reviewing the changes.  Once we had a developer change a global file not knowing what global meant and a bad change was propagated to all solutions.  This caused confusion and delay.

You could have the team doing the merge ignore the folder by using the command-line and using the /discard parameter.  This is where I found that on stackoverflow.com.

We decided on another path.  With TFS source control permissions we can set it so that the teams cannot merge certain folders and/or files.  So when they do the merge it will give a permission error and not attempt to merge it.  This way they don't have to remember what to discard.  The other benefit is if they want to modify a global file it will have to be reviewed and changed by the build team.

Merge vs. Edit

During the merge session the pending changelist was still quite large.  They team was worried that builds would be kicked off by the system for allot of applications that had no changes between the branches except for files that we ignore.  What we noticed in the pending list were two key words.  Some files just had a merge and some had merge,edit next to them.  Doing some digging the merge means it is just creating a merge record but not checking in a new version of the file at the destination.  While merge,edit has both a merge record being created and a new file version being checked in (which will trigger a build).

When TFS Administrator Is On Multiple Teams

Working with Team Foundation Server permissions can be tricky when Deny is the king.  We have recently run into this when one of our administrators is also a member of an active directory group we use for development.  By default each TFS team is a member of the Contributors group.  Because of how we lock down root structures this has locked this admin out of several source code locations.

So for the area they need access to they are a member of the Project Administrators group and the Contributors group.  Both permissions on this area are being set through inheritance.  As an administrator you get all inherited allows.  As a contributor this area has been locked down as it has password information stored.  Thus a contributor gets a deny on read.  Because this is a deny this takes precedence and the administrator gets a permission error when trying to get Latest.  Well it is not really an error but it says all files are up to date but it is grayed out.

The Solution


This is becoming more routine which may be a bad thing.  To allow access to the administrator you must stop inheritance on the area.  After than just remove the Contributors group.  At this point you don't really even need to set a deny on read for the contributors group because they have no access at all.  This allows the Project Administrators group's allow to kick in.  Note that once you stop inheritance what was once an Inherited Allow is not just an Allow.


Tuesday, July 1, 2014

Big and Visible boards in TFS

We have teams starting to use TFS to walk their boards throughout the day.  Previously they used sticky notes or whiteboards with cards.  During this transition some teams have a desktop setup that refreshes the electronic TFS Kanban board (User Story level and above).  Desktop was nice enough to setup a service account with a policy to prevent the screen from locking.  This keeps the Agile philosophy to keep work visible.


What's wrong with this picture?


Well if you add this service account to the team it becomes a contributor.  So anyone walking by now has complete access to the source code.  It probably shouldn't as the purpose of the service account logged in for display is just for board purposes only.


Solution


You will need to explicitly deny this user any access to source control.  Since this may become more than one user I created a new TFS group called NoVersionControl.  This group is denied read for the team project under  the Version Control security tab.



This same group I set to have the same permissions as the Readers group so that it can view the board and test runs.

In addition you will need to mimic the Readers group at the root area for the team project.  Just go to Areas and right-click on the area.  Edit the security to grant Allow access to the NoVersionControl group to View permissions for this node and to View work items in this node.

You will need to buy a Microsoft CAL to be compliant since it is viewing Agile Boards.

Do you see a problem with this setup?


Friday, June 27, 2014

TFS 2013 Source Code Structure and Permissions

Each company will have their own branch structure.  What works for them may not always work for other companies.  Below is an outline of a structure you could certainly adopt.  It is pretty basic and accounts for how we manage our branches and releases.

$/PD
     /TeamX (used interchangeably with a Product)
          /Trunk
          /Branches
          /NonBranchedAssets
     /OrProductX
          /Trunk
          /Branches
          /NonBranchedAssets

We went with one team project and all of our products and teams under it.  Each product and team has it's own area and are represented as folders under the root of the team project.  In the example above the team project is $/PD.  A team or product for example is the Architecture folder.

Under each of these are three base folders.  Each team has this same structure for consistency.  This helps as developers may move around and they won't have to learn a new structure (one big happy team.)

We use the branch structures one of two ways depending on what types of releases we do.  The first scenario, A,  is for some of our longer development cycles.  The other scenario, B,  is for teams who release every iteration.  In some of the images you will note another layer folders called Managed and Unmanaged.  We use this layer to distinguish branches that have a managed environment to go along with them and ones that do not (sandboxes or personal branches).  In my examples I will omit these for simplicity.


Branch Scenario A


In this scenario Trunk is used as the primary development branch for the next release.  Project or Feature branches would branch off of this and end up for example under /Branches/FeatureA.  When complete they would merge back into Trunk and be included in the next release.  Because of the nature of the cycles for this software line at code complete an Integration branch is created for the Release.  It would look like /Branches/Integration/1.0 for the first major release.  This frees up Trunk for work to be merged into it from project or features slated for the next release.  As regression testing completes and the project releases to production a release branch is created for any emergencies that may come up.  It would look like /Branches/Release/1.0.  Any fixes made on the release or integration branch are retrofitted back to Trunk as needed.  The last folder, NonBranchedAssets, is reserved for things the team would like to store in version control but are not part of the built product.

$/PD
     /ProductX
          /Trunk
          /Branches
               /Integration/1.0
               /Release/1.0
          /NonBranchedAssets


Branch Scenario B


This scenario is setup for products on short iteration cycles.  It almost works in reverse and seems to work for those teams.  Here the Trunk represents the latest that is in production or shortly will be.  Development's code-line for the current iteration resides on /Branches/Integration.  If they want to work on cards/features and are not sure it will be completed in that iteration they would create a branch from /Brances/Integration/ to /Branches/FeatureA.  Once FeatureA is DONE it would be integrated back in with the rest of the features being worked on that iteration.  Then when the current iteration comes to an end what has been merged and tested on that branch then gets merged to Trunk.  Some final testing is done on Trunk and that build is deployed to production.  Emergencies would be a branch from Trunk to /Branches/Release/NameOfRelease.  As with the previous scenarios any fixes done for an emergency are retrofitted back to Trunk so as not to create regressions.  An emergency hasn't happened yet but to get the fix I may just have them re-baseline from Trunk to the integration branch.
$/PD
     /ProductZ
          /Trunk
          /Branches
               /Integration
               /Release/ReleaseY
          /NonBranchedAssets


Locking Down Root Structure

To prevent random folders and branches the root structure created is locked down.  This is a deny on various rights to the Contributors group.  Then at the appropriate level this is granted back to the Contributors group (Allow).  The way inheritance and explicit permissions work gives you the flexibility to do this.  

Lock down the team project with a Deny (except for Read).

The folders I don't want people messing with inherit the deny.

Then at the right level grant permissions back with an Allow.  In this case I am showing Trunk.  This would also be done at Branches and NonBranchedAssets folders.

Does this sound like a good plan?  

Thursday, June 26, 2014

TFS 2013 Portfolio Management - Team Administrator

I have been working on setting up one TFS Team Project for all of our products to live under.  This included creating teams and corresponding areas.  Queries for each team (and their respective area) were also created.  The challenge I face today is granting permissions for the team's administrators to be able to add queries to their teams Shared Queries.  

Currently we do not have any TFS teams created and are just using the defaults.  All of our permissions are driven out of active directory.  For example each team has a corresponding AD security group as a member.  This keeps all of our user administration in one location (Active Directory) for the entire company.

To add a Team Administrator it appears you only have the option of adding AD users or groups.  Having a security group as a member would simplify the team administrator management.  I am torn at this point because it would mean a bunch more AD groups.  I can hear the IT guys now on that one. 

I thought about created a VSO TFS team for the administrators of each team but it does not look like you can add a TFS team as a team administrator.  This brings me back to either asking IT for more groups for them to manage or just adding individual users as team administrators.  The down side to the individual user part is then I will have to manage security on iterations and queries at the user level.  This could get messy.

This is the major downside to having everyone in the same team project.  PERMISSIONS!


The Solution


So that IT doesn't come after me for doubling the number of groups they have to managed I ended up creating a TFS group called TeamName Team Admin.  I set this group to have the same base permissions as Contributors.  I did this so if you are in both groups it will not mess up your permissions.  This will always be in sync with Contributors.

With this new group I gave it rights to edit shared queries for the team as well as iterations for the team. Both of these can be achieved by right-clicking on the object (example a query folder) and editing the security for it.  For queries I gave the TFS group Allow on Contribute and Read.  For the iteration (and sub iterations) they were given Allow on Create child nodes and Edit this node.  The Edit this node was needed so they could move sub-iterations between the 3 root iterations they have rights to.

The only downsides are if an admin changes I have to change it within the Team and the team admin TFS group.  My user security is now being managed in two tools instead of one (just Active Directory).  

Any questions please feel free to ask.

Monday, June 23, 2014

TFS 2013 Workspaces with UNC Path

Can you have TFS workspaces with UNC path as the local folder?

The answer is yes. I was able to setup the following and get latest on it:

Source Control Folder = $/My Project/TeamA/Folder B
Local Folder = \\networklocation\TeamA\Folder B

Note the names in the local folder mapping do not have to match exactly.

The security of the folder and files were assigned to me with Full control and the rest of the permissions where inherited from the parent as well.  This all assumes you have permission to write to the network location you are setting up for the workspace.  Ensure the owner has rights and test this out when setting it up.

Belonging to multiple TFS teams

What was happening.

Since I am the admin and created all of the teams I was apart of all of them.  Within Visual Studio 2013 I was connecting to the Team project and working from that in the Team Explorer bar.  By doing this my work for all teams was showing up.  I did not realize until today you could drill down even further and easily switch between teams you belong to right in Visual Studio or Team Explorer.

Switching Teams

If you click on the down arrow and go to Projects and My Teams.  From there you can select the team you want to "join".  Once there Team Foundation Server 2013 will start to reflect that in the sidebar information.


Thursday, June 19, 2014

Setting up Build Machines for Team Foundation Server 2013

Software Requirements on 64-bit Server
  1. Install TFS 2013 Team Explorer
    1. Not supported on Server 2003, http://msdn.microsoft.com/en-us/library/dd997788.aspx
  2. Install TFS 2013 Power Tools

Software Requirements on 32-bit Server (yes we still use a 2003 OS)
  1. Navigate to %temp% or C:\Users\[Username]\AppData\Local and right click on the Temp folder and choose properties, then click the security tab and click advanced.
  2. On the permissions tab you should see the permissions that are there. There should 3 which are:
'SYSTEM' with Full control which applies to 'This folder, subfolders and files'
'Administrators' with Full control which applies to 'This folder, subfolders and files'
'Your Username' with Full control which applies to 'This folder, subfolders and files'
and all 3 should be inherited from the C:\Users\[Username]\ folder.
  1. If you don't have the 'Include inheritable permissions from this object's parent' option ticked, then tick it and click continue if there are any problems, then remove the permissions that aren't inherited.
  2. Unblock all exe's copied to server for installation
     
  1. Install TFS 2010 Team Explorer
    1. You will have to copy all installs locally to the server before running them
    2. Right-click on the setup.exe and perform a Run As (in unrestricted mode)
  2. Install TFS 2010 SP1 by double clicking on the VS10sp1-KB983509.exe.  There is no SP1 for Team Explorer 2010 and Microsoft says SP1 is required.
    1. You will have to copy all installs locally to the server before running them
    2. Right-click on the VS10sp1-KB983509.exe and perform a Run As (in unrestricted mode)
  3. Install Visual Studio 2010 Service Pack 1 TFS Compatibility GDR
  4. Install TFS 2010 Power Tools
     

I included the Power Tools on our build machines because of the extra commands like undo unchanged and the Windows Explorer integration.