Tuesday, November 30, 2010

How to automatically deploy, once Gated checked-in

Solution 1 : Based on Web deploy package
* Create a Web deploy package
* Add extra MSBuild parameters onto the BuildDefinition (such as  /p:CreatePackageOnPublish=true /p:DeployOnBuild=true)
http://www.codewrecks.com/blog/index.php/2010/06/07/create-web-deploy-package-during-a-tfs-2010-build/
and http://weblogs.asp.net/jdanforth/archive/2010/04/24/package-and-publish-web-sites-with-tfs-2010-build-server.aspx
or http://publicityson.blogspot.com/2010/11/tfs-2010-build-and-deploy-with-web.html



Then, once you run and passed the Gated Check-in (or in fact, any TFS Build), you will find all the codes be be installed in the TFS "Drop folder".

Solution 2 : Run a Batch file with the Build definition Workflow :
To do so, you have to use InvokeProcess activity with the Workflow TFS 2010 - how to execute a batch file after build
For more details, see my other post : http://memoprojects.blogspot.com/2010/12/create-custom-workflow-for-tfs-2010.html

Solution 3 : A more "industrialized way" is to use WIX to generate your MSI
First, we have to understand how it works (Ewald Hofman is MVP VS ALM) before specifically use WIX.

Then, you should understand MSBuild ; here are the basics from the MSDN : "Compile Apps Your Way With Custom Tasks For The Microsoft Build Engine"

Finally, use this VERY detailed tutorial "Automate Releases With MSBuild And Windows Installer XML" (MSDN Mag).

Note: Here is a Hello World that will launch Notepad with a new HelloWorld.txt file after the Build,
we first start to create a MSBuild project, for instance mySmallProject.csproj

in which you can find :
 <Target   Name="AfterBuild"
             <Exec   Command="C:\WINDOWS\notepad.exe HelloWorld.txt" />
</Target>

Then the command line :
          msbuild.exe mySmallProject.csproj /t:Build
will build and at the end, it will open your NotePad !

Solution 4: Use TFS Deploy
http://tfsdeployer.codeplex.com/ but this project has only 140 downloads as per today (dec 2010).


How to manage Build increments with TFS 2010

Is it given by default in TFS 2010 ?
Yes according to this Blog.
http://freetodev.wordpress.com/2009/11/07/versioning-code-in-tfs-revised/

Else, you could use MSBuild 4.0 to do so :
http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/11/09/tfs-2010-build-number-and-assembly-file-versions-completely-in-sync-with-only-msbuild-4-0.aspx

Or, here is a GREAT example to extend the workflow floundation :
 "Version Assemblies with TFS 2010 Continuous Integration", using Custom Workflow Activity :
http://geekswithblogs.net/michelotti/archive/2010/05/15/version-assemblies-with-tfs-2010-continuous-integration.aspx

In all cases, a good idea is to rely on CodePlex, such as an MSBuild Extension to ease your life:
http://www.msbuildextensionpack.com/

As a general guidance (Jim LambProgram Manager for Team Foundation Server - build automation features) :



·         If the task requires knowledge of specific build inputs or outputs, use MSBuild
·         If the task is something you need to happen when you build in Visual Studio, use MSBuild
·         If the task is something you only need to happen when you build on the build server, use WF unless it requires knowledge of specifi build inputs/outputs
When using MSBuild, remember that you can customize your project files directly (by unloading them and then editing them in Visual Studio), or you can create custom .targets files and import them into your individual projects. The latter approach is useful for functionality that's common to multiple projects to avoid maintaining multiple copies.
When using WF, remember that you can write code activities for low-level tasks but that you can also compose higher-level tasks using straight XAML. We're actually working on a version of the default build process template that shipped with TFS 2010 that gives you a simpler, less granular view of the overall process by using a set of composed XAML activities.


Monday, November 29, 2010

Don't forget the HotFixes, FeaturePacks, QuickFixEngineering (QFE), PowerTools, ...

(update: see http://memoprojects.blogspot.com/2010/12/alm-tfs-2010-vs-2010-where-to-start.html for up to date versions given in the comments)
To properly work with VS2010 and TFS 2010, it is important to install, at least, the following :


  •  VS10-KB2403277-x86-Prerequisit-FeaturePack-2-for-VS2010.exe
    è   Pre-requisite for Microsoft Visual Studio 2010 Feature Pack 2,
    è https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=32400&wa=wsignin1.0 
  • en_visual_studio_2010_fp2_x86_604352-FeaturePack2-14nov2010.msi
    è From the MSDN subscription website
  • VS10-KB2251084-x86 Cut or Copy displays 'insufficient memory' error.exe
  • VS10-KB2268081-x86-Find and Replace Dialog Growing.exe
  • VS10-KB2345133-x86-FixScrollingContextMenu.exe
  • tfpt-TFS-PowerTools-Sept2010.msi


 And why not :

  •  en_visual_studio_2010_pex_0.94.51023.0_power_tools_x64_598803.exe or
    en_visual_studio_2010_pex_0.94.51023.0_power_tools_x86_598803.exe

37 Case Study on TFS 2010 !!

Ever wanted to find out who is using TFS 2010, and in which context ??

Here's how : http://www.microsoft.com/casestudies/Case_Study_Search_Results.aspx?Type=1&Keywords="Team%20Foundation%20Server%202010"


Tuesday, November 16, 2010

First attempts with CodedUITests with Silverlight 4

In fact my really first attempt with Coded UI was in Dec 2009
http://memoprojects.blogspot.com/2009/12/silverlight-and-microsoft-test-and-lab.html, but, back then, I had  a nice message "Microsoft Silverlight is not supported.. Test paused.".


On the 15th Nov 2010, Microsoft has released VS2010 Feature Pack 2, and I was waiting for a while for it. Now I tried it on our complex Silverlight 4 LOB Application.

1/ .... well, well,  ... here is my first go :
We can record a new Coded UI Test for Silverlight :

However, no Silverlight controls were detected. "Verify that the application under test is built using Silverlight assemblies with a version 4.0 or greater and that a reference to the Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll assembly has been added to the project".

and add the missing DLL : Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll

I was just used to use HP QTP to perform the tests, for which it requires no modification of our application (i.e. no need to add any additional DLLs on our projet - that you have to use a switch mechanism so that they are not released in the production environment ! ).

If you don't add the extra MS DLLs, your Coded UI Test Builder will be empty, even if you click like crazy on your Silverlight application :
After having inserted the DLL on ALL our composite view projects (because of MVVM et PRISM), I ran it again... but still the same problem. Then, I tried to add the DLL only to one project : Still not working.
==> I'll have to try it on a tiny project first.

2/ My second try was on a small Business project :
Seams to work fine and to record... up until the point when I click on "Generate Code"
At that point, my Visual Studio was in debug mode, and I had the nice popup :
"cannot generate code because you are in debug mode" !!

3/ Let's try again !
 Yes it works... but only on a small project, and with few crashes...


4/ Conclusion of my first 'go'
Whereas my first trial of TELERIK WebUI Test Studio with Silverlight was fully satisfactory (with a large Silverlight project with MVVM and PRISM patterns),
my first go with MS Coded UI with Silverlight was a bit disappointing even if it offers more integration with the TFS Software factory.

5/ My second trial : Remove all references to the DLL, excet for 1 project in our MVVM PRISM4 project (i.e. I can record only one screen)

First crash : The Coded UI Test Builder requires me to use a 100% Zoom scale for my IE browser. Else, you'll have this warning "Windows Enternet Explorer zoom setting must be set to 100%. Please change the value to 100% and try again.",






Once back to 100%, this crashes Coded UI !!


Restart again, then the recording FINALLY works !!
However, I never managed to record again (even after a reboot).

Enough for today ! I'll try again another day... hence back to TELERIK WebUI Test Studio et HP QuickTestPro (that requires no additional DLLs on our project to make it work) ;-)

Note : I tried coded UI on the Windows calculator (calc.exe) : no problems. Then I started to use it for "a real need", such as with "SQL Server Management Studio" within wizzard to generate T-SQL Scripts. It works nearly properly : No errors during the recording, but a mini problems do not allow me to use it to "Run" afterwards. Indeed, it stops the playback when dealing with some Drop Down List (although with some DDLst on other windows it works).