Software development can be easier when the right tools, processes and guidance are used. Based on Visual Studio Application Life Cycle Management 2010 (VS ALM 2010) concept, I would like to share some experiences of the last time during a development Life cycle using Team Foundation Server2010 (TFS2010), Visual Studio 2010 (VS2010), MS Deploy, WIX3.X and Scrum Process. Companies becomes more professional and everything must be automated and simple to reduce the daily hectic and support the daily business. One of the concerns at a customer is to automate the build/release/deploy processes. As we already have implemented a .NET Software Factory based on VS ALM2010 (TFS2010, VS2010, MTM2010 and Scrum), we can now take the benefits from all these technologies together to support the customer(s) and meet the needs on short and long term.Below the flow of the Build process based on TFS 2010 Build Management.
Fig 1: Build Process with TFS2010
The customer requirement:
Having a Build strategy where many builds can be done based on Build Definition topology and different configurations like (Debug, Release) for Development, Test and Production stages within 1 build action to have the bits deployed to Development /Test Server (s) and getting Installers ready for Release at Test Server(s).
The flow will be as follow:
1- Define/Configure the Build Definitions below as estimated configurations:
- 1 -Debug.AB (Debug.AutomatedBuild)
- 2 -Release.AB (Release.AutomatedBuild)
To do that, we will make use of TFS2010 Build Management for creating and configuring Build Definitions for each Solution under Team Project(s) as follow:
N.B.: In this example, we consider ImportTagNumbers as Team project / Solution under GenericApplications Project Collection in TFS2010 Instance as shown below:
Fig 2: Team Project (ImportTagNumbers) under (CenericApplications) Project Collection
The solution in the Source Control Explorer looks like below:
Fig 3: Sample Solution Structure under TFS Source Control Explorer
When the solution is loaded in the Solution Explorer, It looks like the following:
Fig 4: Solution with its projects including the WIX Setup Project
The solution and its containing projects (5) must be compiled and succeeded as shown below before executing the builds:
Fig 5: Solution Succeeded Build state
To meet the customer requirement above, a Setup project (Adm.ImportTagNumbers.Setup) is created under the solution based on WIX3.X to create MSI Installers as part of the Automated Build, then 2 Build Definitions (1- Debug.AB and 2 –Release.AB) are created and configured.
1- Creation of WIX Setup project (Tips & Tricks):
Fig 6: Template of creation of WIX Project in VS2010
The creation of this project results in generating a project file with extension .wxsproj and Product.wxs file as shown below:
Fig 7: Created WIX Project Content
To make your setup life easier, groups all the files those are part of the setup in one Component with one GUID and one ComponentRef Id like the following:
Fig 8: Content of Product.wxs file under WIX Project (Grouped Components and its reference)
a- Reference (Web project in your WIX Setup project): That is the web app that will be installed after succeeded Builds and MSI’s.
b- Set the Harvest property of the referenced Web project DLL to True (to generate all the web app content to the output Root directory)
c- Set Project Output Group to Content (otherwise your Web.dll assembly will be generated twice in the Root directory and in under the Bin directory)!
Fig 9: Referenced Assembly Properties by WIX Setup project
In case you would like to use the Install wizard GUI when you execute the generated MSI installer, add the following lines of code to your Product.wxs file:
Fig 10: WIX GUI reference on the Product.wxs file
And configure the Setup project properties by adding the culture information ( -cultures:en-US -ext WixUIExtension.dll ) at the Tool Settings tab as follow:
Fig 11: WIX GUI reference on the Setup project Properties under Test Settings
After compiling the solution and testing the Setup project, then you can execute a Build for that specific solution based on TFS2010 Build Management that will deploy the bits to some developer/test server(S) based on MS Deploy configured via Build Definition (Process). The MSI installer generated from WIX3.x ,will be available as well on the Build output folder under (1 - Debug.AB or 2 -Release.AB) Build Definitions as configured.
Configuring Build Definition by adding Web Deploy or MS Deploy arguments by MSBuild Arguments at the Process tab of the Build Definition (see below).
Fig 12: MSBuild Arguments under Process Tab of Build Definition
With this configuration, a deployment package will be created and deployed to the Build output directory of the specific Build Definition when the executed Build is succeeded.
Under Process step of Build Definition, select Advanced, MSBuild Arguments and use the expected MS Deploy arguments needed like:
Fig 13: Sample MSDeploy Arguments
You can invoke msdeploy with the /? argument and it will display a list of valid arguments.
Based on how the builds will be triggered for some projects/solutions as configured in the Build Definition Trigger step, a Build can be executed/queued for the specific Build Definition (1 -Debug.AB or 2 - Release.AB) in this case. Below the sample of an queued build for the 1 –Debug.AB Build Definition:
Fig 14: Queue Build wizard with pre-defined parameters
After this build is queued, the next screen appears where the queued build is displayed in progress:
Fig 15: Queued Build in progress on the Build Explorer
Double click on the queued build, shows the detailed information of the build steps from the build template as below:
Fig 16: Queued Build Detail Information (WF Build Template information)
When this build is ready, the status and results are shown in the Completed tab of the Build Explorer of the specific Team Project as show below:
Fig 17: Completed Build state on the Build Explorer
Double click on the Succeeded build, results in the Detailed screen of the build as shown below:
Fig 18: Completed Succeeded Build – Detailed Information
The build results (_PublishedWebSites and Setup MSI installer) are show in the configured Build Output directory on the Build Server as shown below for the 1 –Debug.AB Build Definition:
Fig 19: Build output for the configured Build Definition (MSI installer and _PublishedWebSites content)
And the content of the _PublishedWebsites for this web project looks like this:
Fig 20: _PublishedWebSites content of the configured Build Definition on the Build Output Location
If the Build Definition is configured to deploy the bits to a location or Server and to create the deployment package based on the MSDeploy mechanism, the output will look s like this:
NB: The sample below is from another project that has to be deployed to a development Server based on MS Deploy technology. The Deployment Web Package is created to do that as show below:
Fig 21: Content of the Web Deploy package of a specific project that comes with automated Build deployment
Next step for me is to figure out how to delete some folders within WIX setup project in case that some components like (Ajax Tool kit) is used in a project that outputs the culture folders on the Build location as shown below:
Fig 22: Culture Folders of Ajax Tool Kit on the Build Output (Folders to be deleted from WIX setup for clean output)!
Based on the TFS2010 Build Management, MS Deploy and WIX3.X, we are now able to Build, Release and Deploy web Applications as show above in few steps. Of course there are another ways to do that and maybe with other tools as well, but I was inspired by this scenario and as part of the customer requirement that have to be implemented. I hope to help you this way showing how you can automate Build, Release and Deploy Processes (BRD) based on the technologies above.
In my case, many efforts were done on the WIX3.X part as I was not too familiar with It before and because this is a little bit tricky to get things working as you expect (too much manually file editing was needed)!
Package and Publish Web Sites with TFS 2010 Build Server, MS Deploy and WIX:
TFS 2010 Build: