Wednesday, July 14, 2010

Ease your TFS 2010 deployment

This post is not intended to show you all the steps to build and deploy your code using TFS 2010. Instead, it is a short post to demonstrate how few tools and tricks helped me ease my job.

If your budget is restricted, you will not be able to enjoy the full TFS 2010 environment to deploy on an integration environment (VSTS 2010 Lab Management with a prerequisit of Hyper-V, powerfull servers, ...), you have at least the alternatives described below.

1/ By default, Visual Studio 2010 provides a transformation mecanism to deal with many versions of Web.Config (web.debug.config, web.release.config, ...) depending on the environment. However, if you want more than that (e.g. replace strings within App.Config), you will be able to do that for any XML configuration files, when using XML Document Transform (XDT) as described in :
http://vishaljoshi.blogspot.com/2010/05/applying-xdt-magic-to-appconfig.html

2/ Use the default VS2010 "Package/Publish SQL" and "Package/Publish Web" in the Project's Property.


3/ If you love RegExp and want more capabilities in analysing and modifying text within any files, use of the wonderful and robust tool PowerGREP. It could be configured with the advanced UI, then save the configuration file so that it could be run as a command line.

(as per today, it costs 119€ http://www.powergrep.com/)


PS: With far less functionnalities that PowerGREP, but totally free and stable, you have Agent Ransack 2010 that is a file searching tool from Mythicsoft. It is a freeware 'lite' version of FileLocator Pro. However, you cannot replace text in files.


You could also add to your batch file a command to deploy your T-SQL scripts :
osql is a "old" command that comes with SQL Server.

OSQL.EXE -U <username> -P <password> -S <machinename\sqlexpress>
Here is a great oqsl tutorial (french).


Finally, create and call your batch file within your Build Definition, as long as you have extended it with a custom Workflow activity. For instance, Step 4 "Versionning" below does not exist be default,

and comes from a custom workflow activity.



More details on:
http://blogs.msdn.com/b/jimlamb/archive/2010/02/12/how-to-create-a-custom-workflow-activity-for-tfs-build-2010.aspx

and the Best Practices here :
http://blogs.msdn.com/b/aaronhallberg/archive/2009/06/01/writing-custom-activities-for-tfs-build-2010-beta-1.aspx

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.