Build Automation System using Cruise Control .NET (CCNET)

April 30, 2008
In a Team development environment where parallel development and testing goes we find a requirement of getting most recent build to test as well as some specific build to give the QA to do testing on. This post describes what all are needed to set up an automated source code integration and build system for an environment where we use Visual Studio for development, Some source control (VSS, Vault Gear etc) for source depot.

Why do we need a continuous source code integration and build system? well, this helps the QA team by allowing then to not spend more time in syncing the source and doing a build everytime or even working on a relatively older build. This works as a perfect backup for your Source Control and also your deployment server build. This also allows to align the builds numbers to be same as your assembly\file version and also to the source control label there by making a particular build to be a complete unit in itself in terms of readiness for deployment or using the same for development.

Now coming back to build server where we can use cruise control .NET for source integration along with a couple of batch scripts to control the build number and assembly version. CCNET pings the source control (VSS or Vault etc) after every 30 mins (this is a default value and can be changed) to see if there are any modifications. If there are then it triggers a build and publishes it on the Build Server. Once done sleeps again for 30 mins unless it is Forced for a build in between i.e. you can manually force a build in between sleeps.

Let me explain the two components of build server in details below:

1) Cruise Control .NET:
Its an open source build and integration engine which can be downloaded freely from http://confluence.public.thoughtworks.org/display/CCNET/DownloadOnce installation is done CCNET (CruiseControl.NET) needs to be configured according to your requirements. the config file can be found at “%SYSTEMDRIVE%\Program Files\CruiseControl.NET\Server\ccnet.config”.
A Sample configuration looks like below (using Sample Project and Source Gear Vault as source control provider):


2) Batch Scripts (Same Build and Assembly Version):
There are two batch scripts used to control the assembly version. For any executable or dll assembly version is generated based on AssemblyVersion attribute defined in AsseblyInfo.cs file. In order to have same Label and assembly version we can use batch script to change the attribute at runtime and then revert the same at the end of build process again during runtime.

Once the source integration is done by CCNET and is ready for build we change the file attributes of AssemblyInfo files (more in case of multi project solution) to -R so that AssemblyVersion attribute can be changed to build label thereby making the version of generated dll’s and exe’s with the same version. Now to revert back we use another script which changes the AssemblyVersion attribute back to 1.0.0.0 and change the file attribute back to +R there by dodging the source control to not treat this as a modification otherwise it will consider this as a modification and trigger the build again and go to an infinite loop of build 🙂

For mutli project systems where you need many assemblyinfo files to be changed you can use some utilities like replace.exe http://www.bestcode.com/assets/downloads/replace/replace.exe
Below is an example of how a batch script would look like:
#Test1.bat
attrib /S -R AssemblyInfo.cs replace.exe -find “1.0.0.0” -replace “%CCNetLabel%” -fname AssemblyInfo.cs

Complete reference on the configuration blocks can be found at http://ccnet.sourceforge.net/CCNET/ One of the useful publisher which is missing in the above config is Email publisher where-in you can send mails for build success\failure to single\set of people. This help in tracking the build failures and also QA team notification in case of build succeeds.

This can very well be integrated with NUnit for executing test cases ones the build succeeds. This post doesnt cover this though more information on this can be found at CCNET link provided above.

There is a UI support too for CCNET to control the build trigger and view build results\logs. it can be found at http://[BuildServer]/ccnet . The web dashboard for ccnet looks like:

Hope this post will help in case you are planning to set up an automated build and integration system or you are looking for a solution to have same build and assembly version for you current systems builds.

bye for now.


Blog Directory - Blogged

Advertisements

Tips\Tricks for Visual Studio 2005\2008

April 29, 2008

 Today we will look into some quickly accessible and useful features of Visual Studio 2005 and 2008 IDE.

1) Open Solution or Project folder in Explorer –  In Visual Studio 2008 (VS 2k8 ) you can view a project folder in explorer by right clicking the project name and finding a new option named “Open Folder in Windows Explorer” as shown below. Click on this option to open a project in Windows Explorer: 

 In both VS 2005 and 2008 we can view the containing folders but with the help of opened files in the IDE tabs. Right click the TAB of opened file and click on “Open Containing Folder” as shown below:

2) Vertical Split View in Visual Studio 2008 – In VS2k8 a new and cool feature came called slit view. Split view gives a developer with both the code and designer view and with a considerably good performance enhancement in terms of switch between the views. Any change done in code\designer gets reflected instantly in the other view which is really cool. We see the code view at the top of screen and designer view at the bottom in the horizontal direction. We can change it though for wide screens too and this is what I am explaning now.

The default split view of designer and source code is in horizontal orientation in case you want to have a vertical split view, which many a times is very useful in wide screen monitors, you can do the same by choosing following option:

Tools -> Options -> HTML Designer -> Check the box for Split View Vertically option on right pane.

Note: It does not change instantly though in most of the cases. So, you need to close all the files and might need to close and reopen the solution to get this in effect.

3) How to Open a VS2k8 solution targeting .NET Framework 2.0 in VS 2k5 – Multi-target Platforms in one the coolest features of Visual STudio 2008. Because of the multi-targeting support of VS2k8 we can even target .NET 2.0 Framework and just upgrade our old VS2k5 project to use VS2k8 using the default upgrade wizard.

This works fine but then our expectation might be that in case I need to open the same solution now in Visual Studio 2005 it should open perfectly because I did not change the framework version. It does not happen thought and opening the new solution in VS2k5, you get an error message which says that solution is created by a new version:

Why does this problems come? Well the answer is the differences in solution version identifiers. We find some changes both in the solution file and project file. Project file see an addition of directive “Tools Version = 3.5” in the first line this doesnot create any problems for the MSBuild because the framework version is v2.0.

For the Solution file which the IDE uses to read and load the solution we find change in version for File Format which is set to 10.0 for VS2k8 solution. It looks like:

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project(“{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}”) = “ConsoleApplication2”, “ConsoleApplication2\ConsoleApplication2.csproj”, “{42BEBBB6-AB4B-40B9-9CF6-345B62F8B5F4}”
EndProject

The line “Microsoft Visual Studio Solution File, Format Version 10.00” make the solution to put 9 when we look at the solution in explorer view. Now to make the solution readable by Visual Studio 2005 we have to make the following change in new solution file:

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005

Project(“{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}”) = “ConsoleApplication2”, “ConsoleApplication2\ConsoleApplication2.csproj”, “{42BEBBB6-AB4B-40B9-9CF6-345B62F8B5F4}”
EndProject
Now it works perfectly fine in VS2k5 too. The reason behind this is that there are no build\solution file format changes and hence just the version redirection make this solution file to work with a specific VS version.

Hope this will help working with solutions targeting .NET V2.0  and working on VS 2005 or 2008.

More to be followed hence keep checking.

bye for now.

 


my IE8 Beta1 Experience

April 28, 2008

 IE8 Beta1 was released in March by Microsoft and I started using\testing it to see the new and visible features out of it. The official download site from Microsoft is http://www.microsoft.com/windows/products/winfamily/ie/ie8/customizelinks/default.mspx 

 Certain noticeable changes which I found in IE8 are: 

1) The website address in address bar is grayed out except for just the main address eg. any pages from Microsoft.com is requested everything else grayed out except Microsoft.com. 

2) Emulate IE7 button has been provided for the users who want to have the same browsing experience as IE7. 

3) A quick link to web test recorder 9.0 which works well in conjunction with Visual Studio. ( in IE7 too )

4) Better Quick Tabs (Ctrl-Q) where we see a bigger and clear tab preview. (in IE7 too) 

5) Ability to use and add new activities for any page. 

6) One of the new additions in IE8 (already present in Mozilla) is the ability to save browsing sessions and hence when you close you browser with any website in opened state and then open IE again it asks to restore the session or start new. This is a good improvement in IE8. 

7) Developer Tools — Its the new and coolest addition in IE8 of all. This enables a user to have more closer look into the html\CSS and script used in any web page apart from having Script Debugging ability for any webpage which makes it a cool utility. It doesnt exactly has the same user experience as Visual Studio in terms of short-keys but has the same experience in showing watch\locals\callstack etc. This needs some more refinement in terms of the functionalities provided by Dev Tool bar which has been replaced by the developer tools. I hope those will be included in the future Betas.

Goodies from Developer Tools: 

1) Debugging experience from within IE would enable a professional\hobbist to play around with any\developed webpage and find\correct any bugs in the page.

2) You can debug any of the javascript and Ajax code from the Developer Tools utility. This is a great boost for the ever increasing Ajax developers from Microsoft. 

Some downsides of IE8:

1) Currently exisiting websites doesnt properly render on IE8 and I find a lot of style problems with IE8. This makes the browsing experience frustating as you try to interact with any website and it just does not respond properly and many of the controls either not work or are not properly rendered. I expect this to be rectified in coming releases.

2) Many of the Ajax controls like calender doesnt properly work in IE8. Trying to find out more 🙂 

3) Devtool Bar doesnt get installed on IE8 (It would have been good to see it there until we get all the functionalities ported to developer tools) and even if you uninstall IE8 and try to install DevTool Bar it still doesnt get install. You need to uninstall IE8\IE7 and then only you can get it inistalled and working.

4) Developer Tools needs more improvement in terms of UX while debugging as a user expects the same experience as Visual Studio for short-keys at least. 

Overall its good to install IE8 and test it but if you are looking from the development perpective or interacting with a lot of websites, then, I think its not completely ready yet.

Hope to have good time testing IE8.

bye for now.

 


How to enable CLR in SQL Server 2005

April 25, 2008

SQL Server 2k5 has .NET Integration as one of the cool features which enables writing Managed Code for user defined fucntions and then getting those running with SQL Server. SQL Server hosts the in process CLR for executing the user defined functions and referenced assemblies once CLR is enabled for SQL Server.

So lets see how we can do that…

Step1:
We need to use the SQL Server Surface Area Configuration for the same which can be found in your All Pragrams -> SQL Server 2005 as shown below

Step2:
Select Surface Area Configuration for Features from the Wizard

Step3:

Select “CLR Integration” from the left pane. And Check the box for enable CLR to get the required result

Hope this helps in case you want to add your Managed assembly or a function to the SQL Server and finding it not running because of CLR not enabled. Hope this blog will help you solve any such problem.

bye for now.


Just another blogger :)

April 23, 2008

Don’t just go with the title 🙂 it might be misleading. So, here is Sushant starting to share his personal and professional experiences, observations, thinking and views on various domains\areas\things etc.

My Blog Title “Take it or Make it” tells about what I think. It means take things\proceedings etc as they originally are OR make\change them as you want it. This, in my opinion, applies to almost every aspect of life. We keep on saying things didn’t happen the right way or the way how we wanted them too but did we try to make them as how we want or is it that we just expected or wanted.

On the professional front, I am a B.Tech Comp Sci from IIIT Hyderabad and started my career with Microsoft India (R&D) Development Center as a SDE in Dev Tool Groups. I worked there for Two and a half years and then moved to a Services startup called as Ramp Technology Group, India Center (www.rampgroup.com , http://india.rampgroup.com/) following my Entrepreneurial mindset. I work here as a multi role personality responsible for some projects, technology process setup for new Microsoft Technologies, Internal process setup to help Devlopment environment, Trainer, Interest Group setup’s to facilitate the R&D needs of the company. I will be talking about many technologies we work on or where I have tried my hands on. All the sweet and bitter experiences we have playing with softwares and tips and tricks we can do with VS, SQL, BI, Silverlight, TFS etc etc.

Hope to get good response from you and looking forward to share more…

keep an eye here. bye for now and have a good day.


Who am I what am I doing?

Who am I what am I doing?