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

Build automation and more specifically deployments are one of my favorite things to do with Team Build in Team Foundation Server 2008.  Deployments are not an “out of the box” feature but there are several ways to accomplish this.  I am going to cover some of these different approaches and strategies for doing deployments with TFS.  Before I get into doing the actual deployments, I want to give a some background and guidance behind why creating automated deployments are part of a good software configuration management (SCM) process. Then I will go into creating a MSI that supports automated deployments.   The subsequent posts will cover a variety of topics including deploying the MSIs with Team Deploy and deploying Click Once applications.  Lastly I will explore what automated deployments will look like in TFS 2010.  As always, if you have any questions or if there is something you want me to see, send me an email, tweet, or comment.

This deployment process has been an evolution of the past 3 years.  I began getting engaged in this process when I used to be part of a process where the development team created a MSI for test and a couple weeks before production our PC configuration team would create a new MSI with their tools.  We would do some testing of this MSI over those couple weeks before going to production.  Unfortunately this process led to a few mistakes, mostly due to the fact we were changing too much too late in the game.  We began to think of an improved process with better configuration management in mind.  We created a few rules to that we wanted our new process to follow. 

Rules for MSIs

  • Create the MSI early in the development process – As early as a development team has most of the projects for the deployment created, compile the assemblies and create the MSI.  For Agile teams this can be as early as Iteration 1.
  • Create a MSI that is easily updated – MSBuild and Team Build by default do not support building setup projects.   There are some workarounds to being able to build a MSI, but I prefer creating the MSI and choose “As  loose, uncompressed files” for the build in the setup project properties.   This will leave the files out of the MSI and basically add pointers to the files in the MSI.  This makes updating the MSI as easy as using the copy task.  If a new project is added to the solution, add the new dependency, rebuild the MSI, and add the new assembly to the copy process (more on this later)
  • Config files – This could probably be a post by itself.  Basically there are a couple rules I have about config files. 
    • The config files for all of the environments must be checked in to source control.  Usually I will create a library project in the solution and add all of the config files to it.
    • Along with all of the files being in source control, there can be no editing or copying of config files once the application is deployed.  For too long I would always copy the config file from the installed location.  Then I would do the uninstall, reinstall, and then copy/modify the config file based on the one I copied to another file.   I did this because I didn’t know if there were changes or particular production settings that were not in the MSI.  
    • Lastly the MSI should contain all of the config files for all of the environments.  These can be removed after the installation process is done but the key is that the config files are not copied from another location.  This will become more clear when I start to walk through the process.
  • Because the MSI contains the config files for multiple environments, the user must be able to select the appropriate environment to install.  The MSI should allow the the user to specify the environment in the wizard or through a command line argument when installing it in quiet mode.
  • If the MSI is a windows service, the user must also be able to specify the username and password through the wizard or command line.

 

By following these rules, it provides the following enhancements

  • Tested and Proven MSI – Just like we shouldn’t deploy code that we haven’t tested, the same is true for the deployment process.  By using the same MSI in the Test environment, throughout the development cycle, and in production, this will help ensure that that are no surprises when deploying to production.
  • Ready for Automated Deployments – The MSI will include key features that are required for use in automated deployments.   These include the config files for multiple environments, easily updateable from Team Build, and supports passing environment and username/password by command line.

In the next part, I will go over the steps and processes for creating a MSI to support these rules and help enforce your configuration management process.  I will demonstrate how to do all of this within Visual Studio without using any 3rd party tools.

Mike

Tuesday, July 14, 2009 5:13:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [1] -
Team Build | Team Foundation Server

# Thursday, July 09, 2009

This week I was informed my presentation, “An Iteration in the Life of an Agile Team with Team System 2010” was added to the schedule at the Heartland Developer Conference 2009.  I am excited to be presenting at this event that usually sells out around 600 attendees.  It is going to be huge. There are a lot of great speakers and topics.  Scott Guthrie is one of the keynote speakers!  My session is October 16th at 2:00pm.  I am looking forward to this session that will be a unique, real world way of demonstrating some of the new features of Team System 2010.

Presentation Summary

This presentation will demonstrate a complete two week scrum iteration from the planning meeting to development, testing, and bug fixing to deployment utilizing the features found in Team System 2010. New features include gated check-ins for Continuous Integration (CI), Test-Driven Development (TDD), Product Backlog enhancements including hierarchical views and support for multiple teams to work from a single backlog. The presentation also demonstrates the enhancements to the TFS Portal and Web Access to support Agile planning and displaying graphs such as burn-down charts. Each walk through includes a live demonstration of the feature in Visual Studio Team System 2010.

I hope to see everyone there!

 

Mike

Thursday, July 09, 2009 12:48:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
HDC | Team Foundation Server

# Tuesday, July 07, 2009

Is Microsoft’s new search engine, Bing, finally making a dent in Google’s dominance?  While overall I have read that they are making a little progress, I have noticed some substantial changes in my blog statistics that I’m jokingly calling the “Bing of Life” attack (as to the Ping of Death).  In fact Microsoft has passed Google for the top spot in referrals.

topreferrers

Although Microsoft doesn’t make up the biggest share of search engine traffic the percentage is close to 40%.  They used to only have 5 to 10% share.

searchenginecompare

So Microsoft is getting the numbers but how about the quality?  When I compare the search engine phrases, these results still favor Google.  The Bing search phrases appear to be one word items like Server and Deploy.  The Google ones are what I would expect visitors to be searching for to get to my site.  Here’s the comparison:

Google - Phrases
csla.net example
csla validation 
csla 3.6 codesmith
csla samples 
CSLA.Net 
csla templates 
"The workspace" "already exists on computer"
vsp1030
csla examples
TestToolsTask

Microsoft Network - Phrases
server 
deploy
smart
april
hostbridge
generation
build
sessions

I don’t get enough traffic to my blog to know if these results are scale to larger sites, but I thought it was interesting anyway.  If you have a website or blog, are you seeing any kind of traffic or percentage increase from Microsoft’s Bing?

Mike

Tuesday, July 07, 2009 9:55:00 PM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
General

# 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

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 2012
Mike Douglas
Sign In
Statistics
Total Posts: 76
This Year: 0
This Month: 0
This Week: 0
Comments: 52
All Content © 2012, Mike Douglas
DasBlog theme 'Business' created by Christoph De Baene (delarou)