Continuous Learning and Sharing of Team Foundation Server and Application Lifecycle Management RSS 2.0
# Thursday, July 02, 2009

In many of my projects I will create a new release branch when our code is ready for production.  This gives me a snapshot of the code when it went to production.  This allows us to make any bug fixes in the production code base but continue adding new features to dev and test branches.  This has always been a manual step to create the branch until i was talking to a client and suggested that I could automate this process.    I hadn’t done a branch from within Team Build but I knew it could be done via the command line so I figured we could automate it.    I used the Exec task to create the branch like this:

<Exec WorkingDirectory="$(SolutionRoot)"
       Command="$(TF) branch $/MyTeamProject/Main/ $/MyTeamProject/Releases/2.1.0.0 /noget"

Next the build needed to check in the branch:

<Exec WorkingDirectory="$(SolutionRoot)"
  Command="$(TF) checkin /comment:&quot;***NO_CI***New Release Created&quot; /noprompt
  /override:&quot;New Release Created&quot; /recursive"
  IgnoreExitCode="true" />

This was the easy part.  One of the challenging parts was the workspace mappings.  Even though I could get this to work by creating a mapping at the root of the team project, I didn’t want to pull down all of the branches under source control.   If I didn’t have the mappings at a high enough level to cover the target, the build will generate an error like this:

No appropriate mapping exists for $/MyTeamProject/Releases/2.1.0.0

Since with each release this problem would compound, I wanted to only pull down the necessary source control.  To solve this problem I created a custom task that takes a parent folder, in this case $/MyTeamProject/Releases/ and either cloaks all of the subfolders to only add a new row, or it will cloak all of the folders except for the one specified.   The second option is beneficial if the source folder for the branch is dynamic also.  This will also create a dynamic mapping between the WorkspaceServerItem and WorkspaceLocalItem.

The task is called CreateDynamicMapping and here is the call:

<CreateDynamicMapping
  TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
  BuildUri="$(BuildUri)"
  WorkspaceServerItem="$/MyTeamProject/Releases/"
  WorkspaceLocalItem="$(SolutionRoot)\Releases"
  WorkspaceName="$(WorkspaceName)"
  WorkspaceOwner="$(WorkspaceOwner)"
  ParentFolder="$/MyTeamProject/Releases/"
</CreateDynamicMapping>

This example uses the ParentFolder to get all of the child folders, loops through each of them and if it finds a match to the WorkspaceServerItem (It won’t in this example because it isn’t a child folder of the ParentFolder) it will keep that folder, otherwise it cloaks the folder so it is not pulled down.

Creating this task was my first opportunity to use the TFS API.  With the help of some great posts by Shai Raiten, this ended up straight forward and even wrapped some unit tests around make sure it worked.  Here’s the main part of the code for the task:

TeamFoundationServer tfs = new TeamFoundationServer(teamFoundationServerUrl);

// Get a reference to Version Control.
VersionControlServer versionControl = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));

Workspace[] workspaces = versionControl.QueryWorkspaces(workspaceName, workspaceOwner, null);

if (!parentFolder.Contains("*.*"))
{
    parentFolder += "/*.*";
    parentFolder = parentFolder.Replace("//", "/");
}
RecursionType recursion = RecursionType.OneLevel;
ItemSet itemSet = versionControl.GetItems(parentFolder, recursion);
foreach (Item item in itemSet.Items)
{
    if (workspaceServerItem.ToUpper() != item.ServerItem.ToUpper())
    {
        workspaces[0].Cloak(item.ServerItem);
    }
}

workspaces[0].CreateMapping(new WorkingFolder(workspaceServerItem, workspaceLocalItem));

This is what you need to automate the branching process from with a TFS Build.   I didn’t talk about how to get your version number to branch to.  This will depend on your projects requirements.  You may want to use get the assembly version of one of the assemblies you compiled to use this as the folder or in this instance the source folder was dynamic too.

Mike

Thursday, July 02, 2009 5:01:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
Team Build | Team Foundation Server

# Thursday, June 25, 2009

 

Today I was installing Team Foundation Server 2008 on a Windows Server 2008 server where I installed WSS 3.0 SP2 when I realized I was going to get error connecting to an existing Windows SharePoint Services server.  The error is TF220037: The Windows SharePoint Services administration site could not be found at the following location:  http://myserver:17012

image

 

Basically this error means that it can’t find the WSS Central Administration site.  Usually when I see this error it means that the WSS Central Administration site is installed on a different port.  The easiest way I have found to get the correct port number is to open the Central Administration site and look at the port in the URL.   In my example below the correct port is 21810.  I simply updated the port on the installation screen on the left and it worked fine.

To open Central Administration,  go to Start > Administrative Tools > Central Administration.

image

That’s it! I hope it helps.

Mike

Thursday, June 25, 2009 9:04:00 PM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
Team Foundation Server

# Thursday, May 28, 2009

Thanks everyone for attending the meeting on Tuesday.   It was a great time.  I thought the attendance was good, especially for the day after a holiday and there were a lot of great questions asked.   I hope everyone picked up some good tips that will help them implement Team System and Team Foundation Server.   If you run into any problems feel free to contact me.  I would be happy to try to help.

Here are the slides.

Installing_and_Configuring_Team_Foundation_Server_2008.zip (603.07 KB)

Mike

Thursday, May 28, 2009 3:31:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [2] -
Team Foundation Server

# Sunday, May 24, 2009

Team Foundation Server 2008 requires administrators to manage user and group permissions in three locations.  Users must be added to the appropriate permissions in TFS, SharePoint, and SQL Server Reporting Services.  Doing this manually is cumbersome.  The TFS Admin Tool is a free add-on to Team Foundation Server that makes this process much easier.

I was installing the latest version 1.4 on Windows Server 2008 and received the message “Please wait while the installer finishes determining your disk space requirements.”  when I clicked on Next after the EULA.

image

I had a hunch it was UAL and I needed to do “Run As Administrator” to make this work.  Unfortunately with MSIs there is no “Run As Administrator” option in the context menu.  To work around this I opened an “Administrator Command Prompt”.  Here I ran MsiExec against the Msi and it worked fine.

C:\Users\Administrator>msiexec /i c:\users\Administrator\Desktop\TFSAdminToolSetup.msi

Mike

Sunday, May 24, 2009 10:18:00 PM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
Team Foundation Server

# Wednesday, May 20, 2009

Last week I added a MSI for installing Team Deploy.   I am excited about this because this simplifies the installation process.  Simply run the MSI and it installs all of the components for Team Deploy.  Team Deploy still requires the separate download and installation of PSTools.   Also, if you have an older version of PSTools, download the latest version to help ensure it works with the latest version of Team Deploy.

Here is the listing of installed files with the MSI.

image

I have also included a “real world” type deploy script and TFSBuild.proj file based on some great feedback I have received.  These should show some good examples of how to use it.

As always you can find Team Deploy at http://teamdeploy.codeplex.com.

Mike

Wednesday, May 20, 2009 3:53:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [2] -
Team Build | Team Foundation Server

# Sunday, May 03, 2009

It has been awhile since I have been able to work with Csla.  Recently I have gotten a chance to use it again.   The last time I used Csla was with version 2.0.  Rocky has made a lot of really cool changes since 2.0.  In this new project I am going to use version 3.6 so I wanted to learn how to do things the new way instead of the way I was doing it in version 2.0.  His project tracker example is very thorough and covers almost every possible way to use Csla 3.6 but I think it can be overwhelming to a new user even with the book.  I wanted to create a sample that is more simple so I could easily understand the changes and help my other team members get up to speed with Csla.  

Here’s some of the features I included:

  • Custom base classes – I wanted to create a custom layer between the Csla base classes and my implementation.  This is a good practice that allows framework changes in the base classes instead of modifying the Csla framework.  This should make upgrades to newer version easier.
  • New property declarations– uses new PropertyInfo class to manage the properties to help eliminate code.
  • EditLevels – While this is not new, I hadn’t used it before.
  • Child_xyz methods – new methods in Csla DataPortal for loading, update/insert, and delete for child objects.  Helps reduce code and provides more clear code.
  • WCF – It wasn’t clear to me how to switch between 2 tier and 3 tier modes using WCF so I wanted to implement it.  The .
  • BindingSource – This also isn’t new but a good practice.
  • Save Auto-Enabled – Using the bindingsource’s CurrentItemChanged event handler, it will update the Save button on row change of the grid.   The next version of this will use the Csla Action Extender component.

Here’s the download (includes csla dll).  Enjoy!

cslawcfexample.zip (657.59 KB)

Mike

Sunday, May 03, 2009 3:20:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
CSLA.NET

# Thursday, April 30, 2009

I normally don't just post links to another post but this post by Brian Harry really got me excited about TFS 2010.  It appears Microsoft has addressed almost every limitation of the TFS 2008 installation and configuration.  He explains all of the components of TFS and provides some great screenshots.  Check it out!

http://blogs.msdn.com/bharry/archive/2009/04/30/tfs-2010-admin-operations-setup-improvements.aspx

Mike

Thursday, April 30, 2009 11:03:57 PM (Central Daylight Time, UTC-05:00)  #    Comments [3] -
Team Foundation Server

# Monday, April 27, 2009

I am excited to announce that I am going to be presenting at the next Omaha Team System User Group meeting on May 26th, 2009.  In addition to what I think is a great topic that I am looking forward to presenting, Deliveron Consulting Services is co-sponsoring the meeting and giving away an XBOX 360, a NFM gift card, and two TFS books!  WOW!  I look forward to seeing everyone there. 

Here’s the information on the presentation:

Installing and Configuring Team Foundation Server 2008

This presentation provides an overview of TFS 2008 and demonstrates best practices, lessons learned, and “gotchas” installing and configuring TFS 2008.  The overview explains the architecture and components of Team Foundation Server 2008 and recommended server configurations.  The demonstrations will include using the Best Practice Analyzer, Setting User Permissions and using the TFS Admin Tool, and creating and configuring a Team Project from start to finish.  The configuration process will include recommended settings, source control folder structure, and creating appropriate notification.  The presentation will conclude with techniques and lessons learned for troubleshooting problems with installations.

About me

Mike Douglas is a Solution Consultant at Deliveron Consulting Services where he provides end-to-end solutions and TFS installation, configuration, and custom development for clients.  He has over 11 years experience building enterprise level applications on a variety of .NET technologies including WCF, Web Services, ASP.NET, Disconnected Smart Clients and Data Synchronization, BizTalk, and Team Foundation Server.  Mike enjoys trying to keep up with the constant change and evolution of .NET.  Mike is an experienced presenter having spoken at several Omaha .NET User Group meetings on CSLA.NET, Subsonic, and TFS.  He also spoke at the 2008 ESRI International User Conference on a GIS integration project he helped lead. Mike actively maintains the open source project, Team Deploy, on CodePlex for deploying MSIs using Team Foundation Server.  Mike also enjoys sharing his experiences in Code Generation, CSLA.NET, and TFS on his blog at www.CodeSmartNotHard.com.

Date and Location

May 26th, 2009

Farm Credit Services of America
5015 S 118th St
Omaha, NE 68137

For more information and to register, visit the Omaha Team System User Group site.

Monday, April 27, 2009 11:05:33 PM (Central Daylight Time, UTC-05:00)  #    Comments [3] -
Team Foundation Server

# Wednesday, April 22, 2009

Today I am excited to announce the release of Team Deploy 2.0.  Additionally, the total download count of Team Deploy has passed 1000 downloads!  

Team Deploy is an open source package of custom build tasks designed for Team Foundation Server 2008 for deploying MSIs to clients and/or servers.  There is also a build notification task for lava lamps or street lights with your builds.

The enhancements and fixes for 2.0 include:

  • Added TaskBase class for common functionality for example,BuildUri and TeamFoundationServerURL. These properties are now optional. It will basically skip the build step display if these properties are not set. All tasks inherit TaskBase.
  • Added check to "StopService" so it only does it if the service exists and it "canstop". (bug)
  • Added new RemoteExecute task. Now call any executable on target machines. This also has a WaitForExit property to be able to wait for the response or not from the target machine.
  • Added setup MSI to install Team Deploy instead of manual steps.
  • Added IgnoreExitCode attribute to the base class. If the task checks for exit code it now will log it as an error if the code > 0 unless IgnoreExitCode == true.
  • Fixed a problem where with the new version of pstools, it wouldn't work unless session zero is specified.
  • Updated the deploy task to ignoreexitcode when calling the Kill task
  • Added logic to stopservice to not try to stop if it isn't installed or started.

    Future updates to Team Deploy will include breaking out the build light notification portion to a new CodePlex project I created called TFSBuildLight.  Also 2.x versions will continue to be for Team Foundation Server 2008.  New 3.x versions of Team Deploy will be developed for Team Foundation Server 2010.

     

    Team Deploy is a free to download and use.  You can find it at http://teamdeploy.codeplex.com.

  • Wednesday, April 22, 2009 4:28:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [5] -
    Team Build | Team Foundation Server

    # Wednesday, April 15, 2009

    I wanted to take a look at writing SQL Reports for TFS.  I was going to install the Business Intelligence Studio for SQL Server 2005 but I thought it would be better to use the latest edition of SQL Reporting Services in SQL Server 2008.   So I decided to upgrade my TFS Test Server to SQL Server 2008.  This is a single server install of TFS.   I ran the SQL Server 2008 Upgrade Wizard.     Most of the steps were straight-forward.  I only ran into one roadblock that I was able to fix and I documented below.  Here’s the steps.

     

    First I chose the “Upgrade from SQL Server 2000 or SQL Server 2005” option.

    image

     

    I kept the default settings for all of the steps except when it asked what instance I would like to upgrade.

    image

     

    All of the checks passed but one.  I got the following error.

    Rule "Security Group SID (Security Identifier)" failed.

    image

    http://go.microsoft.com/fwlink/?LinkId=94001

    I went to the link but it didn’t help.  I searched on the web for for the error and I found the fix here.  Basically I had to manually replace the invalid SIDs with the new one.

     

    To find the correct SIDs, I ran the command prompt utility:  whoami /groups

    image

     

    If you have multiple editions of SQL Server installed make sure you are in the correct one in the registry.  Look at the Edition key

    image

     

    I pasted the correct SIDs into the registry keys

    image

     

    I fixed the ones in MSSQL.2 but I was still getting the error.  I checked the log file %ProgramFiles%\Microsoft SQL Server\100\Setup Bootstrap\LOG\Detail.txt and here is the error.

    2009-04-14 23:24:25 Slp: Sco: Attempting to open registry subkey SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.3\Setup
    2009-04-14 23:24:25 Slp: SqlSidRule.GetSidValue - reading value name ASGroup
    2009-04-14 23:24:25 Slp: Sco: Attempting to get registry value ASGroup
    2009-04-14 23:24:25 Slp: Sco: Attempting to get account from sid S-1-5-21-3621347759-1475631895-1437307089-1014
    2009-04-14 23:24:25 Slp: Sco: LookupAccountSid failed for SID S-1-5-21-3621347759-1475631895-1437307089-1014
    2009-04-14 23:24:25 Slp: SqlSidRule.EnsureGroupExists - Exception caught and ignored. Returning false. Exception message is No mapping between account names and security IDs was done.

    I grabbed the SID for the ASUser and it worked!

     

    The wizard continued and finished.  I launched Visual Studio and TFS is working properly.

    Now I can look at the SQL Reporting :)

    Wednesday, April 15, 2009 3:03:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [2] -
    SQL Server 2008 | Team Foundation Server

    Visual Studio ALM MVP
    Microsoft Visual Studio ALM MVP
    Archive
    <July 2009>
    SunMonTueWedThuFriSat
    2829301234
    567891011
    12131415161718
    19202122232425
    2627282930311
    2345678
    Blogroll
    About the author/Disclaimer

    Disclaimer
    The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

    © Copyright 2014
    Mike Douglas
    Sign In
    Statistics
    Total Posts: 101
    This Year: 7
    This Month: 0
    This Week: 0
    Comments: 86
    All Content © 2014, Mike Douglas
    DasBlog theme 'Business' created by Christoph De Baene (delarou)