DCSIMG
July 2008 - Posts - Shai Raiten's Blog

Shai Raiten's Blog

It's all about code...

July 2008 - Posts

How to : Add custom build step messages to TeamBuild process

How to : Add custom build step messages to TeamBuild process

The following sample task illustrates how to add custom build step messages to the build process.

using System;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Build.Proxy;
using System.Threading;
 
// This sample references Microsoft.Build.Framework.dll, Microsoft.Build.Utilities.dll,
// Microsoft.TeamFoundation.Build.Common.dll, Microsoft.TeamFoundation.Client.dll,
// System.dll, System.Web.Services.dll
 
namespace TeamBuildSampleTasks
{
    public class SampleTaskWithCustomBuildStep : Task
    {
        private string m_teamFoundationUrl;
        private string m_buildNumber;
        private string m_teamProject;
 
        [Required]
        public string TeamFoundationUrl
        {
            get { return m_teamFoundationUrl; }
            set { m_teamFoundationUrl = value; }
        }
 
        [Required]
        public string BuildNumber
        {
            get { return m_buildNumber; }
            set { m_buildNumber = value; }
        }
 
        [Required]
        public string TeamProject
        {
            get { return m_teamProject; }
            set { m_teamProject = value; }
        }
 
        public override bool Execute()
        {
            // Create TeamBuild BuildStore web service.
            TeamFoundationServer tfs = new TeamFoundationServer(m_teamFoundationUrl);
            BuildStore bs = (BuildStore)(tfs.GetService(typeof(BuildStore)));
           
            // buildUri is used later on to identify the build
            string buildUri = bs.GetBuildUri(m_teamProject, m_buildNumber);
 
            // This string is used internally in TeamBuild to identify the message.
            string buildStepName = "Sleep Messages";
            string buildStepMsg = "Build Step: Sleep and get random result";
 
            // Add the build step message to the build process and this will show up in the build report
            // now the status set to 'in progress'
            bs.AddBuildStep(buildUri, buildStepName, buildStepMsg);
 
            // Do task actions here. My sample does nothing but goes to a sound sleep and gets a random result :)
            Thread.Sleep(10000);
            bool result = GetRandomResult();
 
            //update the build step message with pass/fail information
            if(result)
                bs.UpdateBuildStep(buildUri, buildStepName, DateTime.Now, BuildStepStatus.Succeeded);
            else
                bs.UpdateBuildStep(buildUri, buildStepName, DateTime.Now, BuildStepStatus.Failed);
 
            // Log the result into build log file
            Log.LogMessage("SampleTaskWithCustomBuildStep completed, result: " + result);
 
            return true;
        }
 
        private bool GetRandomResult()
        {
            return ((1==new Random().Next() % 2) ? true : false);
        }
    }
}

Traceability Tool Version 1

Traceability Tool - Version 1

I published a post about - Traceability Tool For VSTS Beta 1,
After adding couple of new features and fixing some flow problem here is the new version:

New features in Version Traceability Tool 1

Tests Tracking

1. Tests that already related to one or more requirements are marked with yellow color.
2. Trace and Show tests runs form a specific date.
3. Mini Graph for a specific requirement and all requirements.

v1

Email Reports

1. Schedule Reports - Daily, Weekly, Monthly
2. Manage recipients.

 report-part1 report-part2

How To : Create SQL Server Management Studio Addin

image

Read the full and original article from Jon Sayce Here

In the last post I talked about How To: Create Windows Live Messenger Addin

Now let's create SQL Server Management Studio Addin.

Start:

Let's open Visual Studio and create a new Visual Studio Add-in project.

Step1

Check the right options for your Addin.

step3

After you finish the wizard please add new Setup project.

step4

Add Project output  -> Primary output and change the output group registration to vsdrpCOM

step5

Enter to Registry Editor and add your Addin to SSMS startup.

step6 

 

References

There's extensive documentation on MSDN regarding Visual Studio's EnvDTE object model, which is at the heart of Visual Studio add-in development, and most of this applies to SSMS. Most UI elements are the same for both environments but if your add-in relates to anything SQL-specific then you're going to need references to SSMS assemblies and the documentation on these is non-existent.

IDTExtensibility2 Events

Once you've got the references sorted out, you're ready to start coding.

The template class that Visual Studio has created implements the IDTExtensibility2 interface, but only one of the methods has any code in it so far: OnConnection.

OnConnection "occurs whenever an add-in is loaded into Visual Studio" according to MSDN - in our case the event will fire whenever you start SSMS, once the add-in is installed.

OnConnection will probably be the most important method of the interface for your add-in, but the others can be useful if you need to save settings as the add-in is unloaded or something similar.

SSMS Events

Handling SSMS events is one of the trickier aspects of writing the add-in, the problem being that you don't know what events there are to handle. I suspect Reflector could help here, but the method I used was suggested by Sean.

To add a handler to an event we need to know the command to which that event belongs. The easiest way to find this is to loop through the commands and look for the name which sounds most like what you're after.

For Each com As Command In _DTE.Commands
   Debug.WriteLine(String.Format("Name={0} | GUID={1} | ID={2}", com.Name, com.Guid, com.ID))
Next
.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

Now we complete our Addin infrastructure we can start writing some code!!!

Edit Connect.vb and add a MessageBox inside OnStartupComplete method.

image

Build the project and install the Addin, open SSMS and this is what you should see.

step7

Add New Menu Item

Under Connect Class change to :
Implements the constructor for the Add-in object

Implements IDTExtensibility2
Implements IDTCommandTarget
 
Private _DTE2 As DTE2
Private _DTE As DTE
Private _addInInstance As AddIn
 
Private _CommandEvents As CommandEvents
 
Private _CommandBarControl As CommandBarControl
 
Private Const COMMAND_NAME As String = "MySSMSAddinCommand"

OnConnection Method:
get the events for the command we're interested in (the GUID comes from the output of the previous debug command)
 NOTE: if the _CommandEvents object goes out of scope then the handler will not longer be attached to the event, so it must be a private class-level declaration rather than a local one.

Public Sub OnConnection(ByVal application As Object, ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, ByRef custom As Array) Implements IDTExtensibility2.OnConnection
       _DTE2 = CType(application, DTE2)
       _DTE = CType(application, DTE)
       _addInInstance = CType(addInInst, AddIn)
 
       _CommandEvents = _DTE.Events.CommandEvents("{84125960-B63C-3794-B5D3-9BC47A513E8D}", 1)
   End Sub

OnDisconnection Method: -
Checks whether the control in the tools menu is there if so delete the menu item.

Public Sub OnDisconnection(ByVal disconnectMode As ext_DisconnectMode, ByRef custom As Array) Implements IDTExtensibility2.OnDisconnection
        Try
            If Not (_CommandBarControl Is Nothing) Then
                _CommandBarControl.Delete()
            End If
        Catch
        End Try
    End Sub

QueryStatus Method:
called when the command's availability is updated

Public Sub QueryStatus(ByVal commandName As String, ByVal neededText As vsCommandStatusTextWanted, ByRef status As vsCommandStatus, ByRef commandText As Object) Implements IDTCommandTarget.QueryStatus
       If neededText = vsCommandStatusTextWanted.vsCommandStatusTextWantedNone Then
           If commandName = _addInInstance.ProgID & "." & COMMAND_NAME Then
               status = CType(vsCommandStatus.vsCommandStatusEnabled + vsCommandStatus.vsCommandStatusSupported, vsCommandStatus)
           Else
               status = vsCommandStatus.vsCommandStatusUnsupported
           End If
       End If
   End Sub

OnStartupComplete Method:

Public Sub OnStartupComplete(ByRef custom As Array) Implements IDTExtensibility2.OnStartupComplete
        Dim myCommand As Command = Nothing
 
        ' -----------------------------------
        ' 1. Check whether the command exists
        ' -----------------------------------
 
        ' try to retrieve the command, in case it was already created
        Try
            myCommand = _DTE.Commands.Item(_addInInstance.ProgID & "." & COMMAND_NAME)
        Catch
            ' this just means the command wasn't found
        End Try
 
        ' ----------------------------------
        ' 2. Create the command if necessary
        ' ----------------------------------
 
        If myCommand Is Nothing Then
            myCommand = _DTE.Commands.AddNamedCommand(_addInInstance, COMMAND_NAME, "MySSMSAddin MenuItem", "Tooltip for your command", True, 0, Nothing, vsCommandStatus.vsCommandStatusSupported Or vsCommandStatus.vsCommandStatusEnabled)
        End If
 
        ' ------------------------------------------------------------------------------------
        ' 3. Get the name of the tools menu (may not be called "Tools" if we're not in English
        ' ------------------------------------------------------------------------------------
 
        Dim toolsMenuName As String
        Try
 
            ' If you would like to move the command to a different menu, change the word "Tools" to the 
            ' English version of the menu. This code will take the culture, append on the name of the menu
            ' then add the command to that menu. You can find a list of all the top-level menus in the file
            ' CommandBar.resx.
            Dim resourceManager As System.Resources.ResourceManager = New System.Resources.ResourceManager("MySSMSAddin.CommandBar", System.Reflection.Assembly.GetExecutingAssembly())
 
            Dim cultureInfo As System.Globalization.CultureInfo = New System.Globalization.CultureInfo(_DTE2.LocaleID)
            toolsMenuName = resourceManager.GetString(String.Concat(cultureInfo.TwoLetterISOLanguageName, "Tools"))
 
        Catch e As Exception
            'We tried to find a localized version of the word Tools, but one was not found.
            '  Default to the en-US word, which may work for the current culture.
            toolsMenuName = "Tools"
        End Try
 
        ' ---------------------
        ' 4. Get the Tools menu
        ' ---------------------
 
        Dim commandBars As CommandBars = DirectCast(_DTE.CommandBars, CommandBars)
        Dim toolsCommandBar As CommandBar = commandBars.Item(toolsMenuName)
 
        ' -------------------------------------------------
        ' 5. Create the command bar control for the command
        ' -------------------------------------------------
 
        Try
            'Find the appropriate command bar on the MenuBar command bar:
            _CommandBarControl = DirectCast(myCommand.AddControl(toolsCommandBar, toolsCommandBar.Controls.Count + 1), CommandBarControl)
            _CommandBarControl.Caption = "MySSMSAddin"
        Catch argumentException As System.ArgumentException
            'If we are here, then the exception is probably because a command with that name
            '  already exists. If so there is no need to recreate the command and we can 
            '  safely ignore the exception.
        End Try
    End Sub

 

Build and Install

step8

Add New Window

Let's make our menu item a functioning menu item.
First add new UserControl to the project

image

Modify the UserControl to your needs.

Add this code into Exec Method in Connect.vb
Define a new window as container for the UserControl.

Public Sub Exec(ByVal commandName As String, ByVal executeOption As vsCommandExecOption, ByRef varIn As Object, ByRef varOut As Object, ByRef handled As Boolean) Implements IDTCommandTarget.Exec
    handled = False
    If executeOption = vsCommandExecOption.vsCommandExecOptionDoDefault Then
        If commandName = _addInInstance.ProgID & "." & COMMAND_NAME Then
 
            ' get windows2 interface
            Dim MyWindow As Windows2 = CType(_DTE2.Windows, Windows2)
 
            ' get current assembly
            Dim asm As Assembly = System.Reflection.Assembly.GetExecutingAssembly
 
            ' create the window
            Dim MyControl As Object = Nothing
            Dim toolWindow As Window = MyWindow.CreateToolWindow2(_addInInstance, asm.Location, "MySSMSAddin.MyAddinWindow", "MySMSAddin Window", "{5B7F8C1C-65B9-2aca-1Ac3-12AcBbAF21d5}", MyControl)
            toolWindow.Visible = True
 
            handled = True
 
        End If
    End If
End Sub

 

image

image 

Download MySSMSAddin Project

.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

Team System – How to Create Data Binding Web Test - Screencast [HE]

Team System – How to Create Data Binding Web Test – Screencast

Download MyWebTestProject Demo – Data Binding

In this screen cast I will show how to create Data Binding Web Test (SQL,CSV,XML) with Visual Studio Team Test 2008.

Enjoy!

Team System – How to Create Web Test\Coded Web Test - Screencast [HE]

Team System – How to Create Web Test\Coded Web Test - Screencast

In this screen cast I will show to create Web Test and Coded Web Test with Visual Studio Team Test 2008.

Download MyWebTestProject Demo

 

Enjoy!

SQL Load Testing

SQL Load Testing

Introduction  - SQL Load Test  image

This tool generates a Visual Studio 2005/2008 Unit Test from a SQL Server Profiler trace. The tool extracts all the SQL statements and stored procedure calls from the trace and turns them into a single Visual Studio Unit Test, which can then be configured as a Visual Studio Load Test.
The tool does not interact with the database itself when it generates the test code and so it can be used “offline”.

Requirements:

  • SQL Server 2005 SDK and the SQL Server 2005 Management Tools are installed.
  • Visual Studio 2005/2008 Team Edition for Software Testers.

Demo - Create SQL Load Test

Download SQL Load Test and copy the packaged assemblies to a convenient location.

For this Demo I used "The Beer House" CMS & e-commerce site.
I installed SQL Server and "The Beer House" on my computer.

First let's create new SQL profiler trace file (Template)

Create New Trace File

The trace passed to the parser must contain the following columns, each required event class must include these columns:

  1. EventClass
  2. TextData
  3. DatabaseName - if this is omitted then the trace is assumed to be all for the same database
  4. SPID

Default Configuration 

After you finish configure the trace file press "Run" to start recording.

Open the "The Beer House" site and start perform the actions you like to record.

(Login etc..).

image

When you done with the test scenario stop profiler recording and save the trace file.

Recording

Copy the trace file into the same folder where the packaged assemblies are.

Copy Trace File

Now when you have the trace file ready use the command line tool called DbLoadTestGen to generate Visual Studio Unit Test.
Run it using a command with the following syntax:

DbLoadTestGen.exe <Scenario Name> <Trace File Name> [<Configuration File Name>]

1. Scenario Name. A simple name for the scenario. This must be a valid C# identifier as it is used in the generated code. Avoid using the name of a type or operation in the services under test.

2. Trace file name. The path to the file containing the SQL trace to be processed.

3.Configuration file name. This is optional and it is the path to the file containing the configuration information. If the file is not present a default configuration is used.

For more information read "Database Load Test Tool Usage Notes.doc"

image

When the code generation is done you will see two new files:

SQLTEST.cs - Unit Test
SQLTEST.stubs - Connection String

The stubs file will need to be renamed to a .cs file.
*** The connection string will need to be put into the stubs file.

image

Now we almost ready to run our SQL Load Test.

Just open Visual Studio Tester Edition and create new Test project, Add "SQLTEST.cs" and "SQLTEST.stubs.cs" into the project.

Add SQLTEST.cs Unit Test

Edit "SQLTEST.stubs.cs" and add the connection string and save.

image

Before you create the Load test let's us check that  everything is working properly.

From the "Test View" run the SQLTEST unit test and watch the profiler...

image

Working!!!
Now when everything is working you can add SQLTEST unit test into a new Load Test.

 image

Enjoy. 

Fiddler - QuickExec Reference

Fiddler - QuickExec Reference

Fiddler is one of the most common http debugging tool today.
Most of you know what is Fiddler and what can we do with him.

But for the rest, so….

What is Fiddler?

FiddlerLogo

Fiddler is a HTTP Debugging Proxy which logs all HTTP traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP Traffic, set breakpoints, and "fiddle" with incoming or outgoing data. Fiddler includes a powerful event-based scripting subsystem, and can be extended using any .NET language.

Fiddler is freeware and can debug traffic from virtually any application, including Internet Explorer, Mozilla Firefox, Opera, and thousands more.

QuickExec Reference

Fiddler's QuickExec box allows you to launch script-commands quickly.

Keyboard Hints

  • Hit ALT+Q to quickly set focus to the QuickExec box.  If Fiddler isn't active, hit CTRL+ALT+F first to activate Fiddler.
  • In the QuickExec box, hit CTRL+I to insert the URL of the currently selected session in the session list.
  • There's a hotkey for virtually everything in Fiddler.  See the Keyboard Reference.

Default commands

The QuickExec commands listed below are available in the latest available Beta version of Fiddler. 

Command Action Sample usage
bold Mark any future sessions in bold if the url contains the target string

bold /bar.aspx
bold      <-- Call with no parameter to clear

bpafter Break any response where the RequestURI contains the specified string

bpafter /favicon.ico |
bpafter      <-- Call with no parameter to clear

bps Break any response where the status code matches

bps 404
bps      <-- Call with no parameter to clear

bpv or bpm Request Method breakpoint

bpv POST
bpv       <-- Call with no parameter to clear

bpu

bpu /myservice.asmx
bpu        <-- Call with no parameter to clear

bpu /myservice.asmx
bpu        <-- Call with no parameter to clear

cls or clear clear the session list cls
dump dump all sessions to a zip archive in C:\ dump
g or go Resume all breakpointed sessions g
help show this page help
hide Hide Fiddler in System tray hide
urlreplace Replace any string in URLs with a different string

urlreplace SeekStr ReplaceWithStr
urlreplace <-- Call with no parameters to clear

start Register as the system proxy Register as the system proxy
stop Unregister as the system proxy stop
show Restore Fiddler from system tray -- more useful when triggering rules from ExecAction.exe (see below) show
select Select any session where the response Content-Type header contains the specified string.

select image
select css
select htm

allbut or keeponly Hide all sessions except those where Content-Type header contains the specified string.

select image
select css
select htm

quit   quit

Writing your own commands

You can easily add new commands by editing your FiddlerScript.  Click Rules | Customize Rules.  Scroll down to the OnExecAction function and simply add your own commands.
If you're developing a FiddlerExtension, you can implement the IHandleExecAction interface and handle the OnQuickExec event and respond accordingly.

Using ExecAction.exe

ExecAction.exe is a command line executable which is suitable for calling from batch files or unit tests.  It passes its command line into FiddlerScript's OnExecAction function for processing, just like Fiddler's QuickExec box.  The ExecAction commands can be handled by FiddlerScript or FiddlerExtensions.
ExecAction.exe is installed into the Fiddler directory inside your Program Files folder.

Usage:
               ExecAction SCRIPTPARAMETER
               ExecAction "PARAM1 PARAM2"

ExecAction sets %ERRORLEVEL% to

  • 0 if successful
  • 1 if an incorrect (!= 1) number of arguments used
  • 2 if the Fiddler window could not be found.

How To: Create Windows Live Messenger Addin

How To : Create Windows Live Messenger Addin

This is my first post in a series of posts about Addins.

Next : How To : Create SQL Server Management Studio Addin

Let’s Start":

Messenger Addins are not enabled by default, so to enable Addins for Messenger -

Go to HKCU\SOFTWARE\Microsoft\MSNMessenger and add a DWORD value named AddInFeatureEnabled set to 1

reg

Now launch Windows Live Messenger, sign in and go to Tools, Options, Add-ins. You should see this:

addin

The Basics of Live Messenger add-ins

Windows Live Messenger add-ins are written using a managed library called MessengerClient.dll (can be found in %programfiles%\Windows Live\Messenger) which holds the namespace Microsoft.Messenger.
In order to create an add-in, open up Visual Studio 2005/8, create a new Class Library project (e.g. called "MyAddin") and add a reference to the MessengerClient.dll file:

ref

 

Next, change the project properties so that the assembly name equals the (fully qualified) class name of the add-in. This is important to get the add-in to work. In my case the class is defined as follows:

namespace MessengerAddin
{
   public class MyAddin
   {

So, we need the following assembly name:

 

ass

 

Next, import the namespace Microsoft.Messenger and implement the IMessengerAddin interface:

using Microsoft.Messenger;

namespace MessengerAddin
{
  
public class MyAddin : IMessengerAddIn
  
{
     
private MessengerClient messenger;
     
public void Initialize(MessengerClient messenger)
     
{
        
this.messenger = messenger;
     
}
  
}
}

Example : Create New Status

namespace MessengerAddin
{
  
public class MyAddin : IMessengerAddIn
  
{
     
private MessengerClient messenger;
         
      public void Initialize(MessengerClient messenger)
      {
        
this.messenger = messenger;
        
messenger.AddInProperties.Creator = "Shai Raiten";
        
messenger.AddInProperties.Description = "This Is My Addin";
        
messenger.AddInProperties.FriendlyName = "MyAddin";
        
messenger.AddInProperties.PersonalStatusMessage = "Greetings from MyAddin";
        
messenger.AddInProperties.Status = UserStatus.Unknown;
        
messenger.AddInProperties.Url = new Uri("http://blogs.microsoft.co.il/blogs/shair");   
      
}
   
}
}
 
Now compile the project and go to Windows Live Messenger. Load the add-in via Tools, Options, Add-ins:
pick
 
Now you should see something like this:
image
 
Click OK to continue. In the Windows Live Messenger main window, click your nickname and choose "Turn on "MyAddin"":
 
active

Example : Auto Responder

public void Initialize(MessengerClient messenger)
{
  
this.messenger = messenger;
   messenger.OutgoingTextMessage += new EventHandler<OutgoingTextMessageEventArgs>
   (messenger_OutgoingTextMessage)
;
}

Again, the event handler can be stubbed automatically, but of course you need to supply some additional code:

void messenger_IncomingTextMessage(object sender, IncomingTextMessageEventArgs e)
{
  
string s = e.TextMessage;
  
StringBuilder sb = new StringBuilder();
  
for (int i = s.Length - 1; i >= 0; i--)
     
sb.Append(s[i]);
  
string reverse = sb.ToString();
  
messenger.SendTextMessage(reverse, e.UserFrom);
}
 

Example : Birthday Counter + Settings

 

 public class MyAddin: IMessengerAddIn
   
{
       
private MessengerClient messenger;
       
private System.Timers.Timer tmr;
       
private DateTime birthday;

       
public void Initialize(MessengerClient messenger)
       
{
          
this.messenger = messenger;

           
messenger.ShowOptionsDialog += new EventHandler(messenger_ShowOptionsDialog);

          
tmr = new System.Timers.Timer(5000);
          
tmr.Elapsed += new System.Timers.ElapsedEventHandler(tmr_Elapsed);
          
StartTimer();
       
}

       
private void StartTimer()
       
{
          
if (DateTime.TryParse(messenger.SavedState, out birthday))
             
tmr.Start();
       
}
       
void tmr_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
       
{
           
TimeSpan span = DateTime.Now - birthday;
           
messenger.AddInProperties.PersonalStatusMessage = String.Format("{0} days {1} hours {2} minutes {3} seconds on planet Earth", span.Days, span.Hours, span.Minutes, span.Seconds);            
       
}

       
private void messenger_ShowOptionsDialog(object sender, EventArgs e)
       
{
          
tmr.Stop();
          
SettingsDialog settings = new SettingsDialog(birthday);
          
if (settings.ShowDialog() == DialogResult.OK)
             
messenger.SavedState = settings.Birthday.ToShortDateString();
          
StartTimer();
       
}
   
}

For the Settings Dialog create new windows application called : SettingsDialog
2 Buttons (OK & Cancel)
DateTimePicker


wa

public partial class SettingsDialog : Form
   
{
       
DateTime birthday;

       
public SettingsDialog(DateTime m_birthday)
       
{
           
InitializeComponent();
           
birthday = m_birthday;

           
if (birthday != null)
               
this.birthday = DateTime.Now;
       
}

       
private DateTime bd;

       
public DateTime Birthday
       
{
           
get { return bd; }
           
set { bd = value; }
       
}

       
private void btnOK_Click(object sender, EventArgs e)
       
{
           
this.bd = birthday;
           
this.DialogResult = DialogResult.OK;
       
}

       
private void button1_Click(object sender, EventArgs e)
       
{
           
this.Close();
       
}
   
}
 
Time to try out. Usual steps again: exit Live Messenger, compile, start Live Messenger and enable the add-in. Go to Tools, Options, Add-ins and look at the enabled Settings button now:

 

settings

 

When you click it, you'll see the dialog popping up (unfortunately somewhere in the back - have to check this little issue) with a security warning (caused by the CAS feature):

warning

Ignore this for now (you can solve it by strong-naming the add-in and some good deal of CAS knowledge; add-ins in Live Messenger are sandboxed by putting them in the Internet security zone) and set your birthday:

image

Windows Live Messenger will now start counting the days, hours, minutes and seconds we've spent so far on our lovely planet:

work

 

Warning: This might cause a relatively big amount of internet traffic!

Framework Detector

Framework Detector

I developing a Spell Checker mechanism for people who suffer from dyslexia. Take a Look And Test Me!
When I send my windows application for testing I got a lot of bugs about Errors when starting the application.

I asked the QA, what version of framework is installed on your computer?
They didn’t know the answer for this one.
The QA can’t install the latest framework version, they need to check for each framework.

When you testing a windows application it’s very important to know which framework version is installed on the test computer.

So I wrote a nice tool for this problem. Download Here

Framework Detector

Team Build - Other Useful Properties

Team Build - Other Useful Properties

These are properties that are used by the build process and should not be modified.  They can, however, be used to execute logic conditionally, to parameterize custom logic in the build process, etc.

  • BinariesRoot.  The root directory for binaries - typically the working directory for the build agent + the BinariesSubdirectory property (see above).
  • BuildAgentName.  The name of the build agent running the build.
  • BuildAgentUri.  The URI of the build agent running the build.
  • BuildBreak.  Set to true when a compilation error occurs, otherwise false.  Can be used in build break targets to determine whether they are executing after a compilation error or executing normally.
  • BuildDefinition.  This property provides the name of the definition being built.
  • BuildDefinitionId.  This property provides the integer ID of the definition being built.
  • BuildDefinitionName.  See BuildDefinition.
  • BuildDefinitionUri.  The URI of the build definition being built.
  • BuildDirectory.  The local directory being used for the build, corresponding to the expanded working directory of the build agent being used.
  • BuildProjectFolderPath.  This property provides the version control path to the TfsBuild.proj file being run, and corresponds to the ConfigurationFolderPath property of the build definition.
  • BuildUri.  The URI of the executing build.
  • ConfigurationFolderUri.  The version control URI of the directory that contains the TfsBuild.proj file being run.
  • DropLocation.  This property provides the "root" drop location for the build - either the DefaultDropLocation of the build definition or the overridden drop location provided when the build was queued.
  • IsDesktopBuild.  True for desktop builds, false for "standard" build machine builds.
  • LastBuildNumber.  The number of the last build, regardless of its status.
  • LastGoodBuildLabel.  The label created by the last "good" build.  This is the label that will be used to associate changesets and work items with the current build.
  • LastGoodBuildNumber.  The number of the last good build.
  • MachineName.  The machine name of the build agent running the build.
  • MaxProcesses.  The maximum number of processes being used by MSBuild.
  • Port.  The port being used by the build agent running the build.
  • NoCICheckinComment.  The comment which must be included in a checkin to prevent continuous integration from triggering a build.  This is critical for CI builds that need to check files in to avoid triggering an infinite loop of builds.
  • Reason.  (SP1 and later only)  The reason the build was started - None indicates the build was manually queued, Individual indicates that a "build every checkin" trigger caused the build, Batch indicates that a "rolling build" trigger caused the build, Schedule indicates that a scheduled trigger caused the build, and ScheduleForced indicates that a scheduled trigger that builds whether or not changes have occurred since the last build caused the build.
  • RequestedBy.  The user that requested the build - for triggered builds, this will typically be a service account.
  • RequestedFor.  The user for whom the build was requested - for CI builds, this will be the user whose checkin triggered the build.
  • SolutionRoot.  The root directory for source files retrieved from version control - typically the working directory for the build agent + the SourcesSubdirectory property (see above).
  • SourceGetVersion.  The version spec that will be used to retrieve sources for the build, unless the GetVersion property is overridden.
  • StartTime.  The time at which the build started.
  • TeamBuildConstants.  Allows projects being compiled to determine whether Team Build is compiling them.  Default value is "_TEAM_BUILD_".
  • TeamBuildOutDir.  The directory Team Build would have set OutDir true if CustomizableOutDir and/or CustomizablePublishDir (see above) were false.  If both are true, this value is equivalent to OutDir. 
  • TeamBuildRefPath.  Provides the path to Team Build binaries (the logger, tasks, etc.).  Typically %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies.
  • TeamBuildVersion.  This property is set to 2.0 in Team Build 2008 and will be incremented in subsequent versions.
  • TeamFoundationServerUrl.  The URL of the team foundation server that owns the executing build.
  • TeamProject.  The team project of the build definition being built.
  • TestResultsRoot.  The root directory for test results - typically the working directory for the build agent + the TestResultsSubdirectory property (see above).
  • WorkspaceName.  The name of the workspace used to retrieve sources from version control. 

Team Build - Task Behavior Extensibility Properties

Team Build - Task Behavior Extensibility Properties

These are properties that are designed to be overridden by users to control the behavior of particular tasks (e.g. the Get task).  They are organized by task.

  • Get (for more info, see the tf get docs here)
    • ForceGet.  Passed to the Force property of the Get task.  Use of this property is discouraged - use the IncrementalGet and/or IncrementalBuild helper properties instead.
    • GetOverwrite.  Passed to the Overwrite property of the Get task.  If true (the default), writable files will be overwritten automatically.
    • RecursiveGet.  Passed to the Recursive property of the Get task.  If true (the default), the get operation will be recursive; otherwise, the get operation will only get top-level files and directories.
    • GetVersion.  Passed to the Version property of the Get task.  Defaults to SourceGetVersion (see below), but can be overridden to retrieve a particular version from source control.
    • GetFileSpec.  Passed to the Filespec property of the Get task.  Defaults to empty, signifying that the entire contents of the workspace should be retrieved.
    • GetPopulateOutput.  Passed to the PopulateOutput property of the Get task - controls whether the Gets, Replaces, and Deletes properties of the Get task are populated (these provide access to the new files retrieved from version control, the files modified during the get, and the files deleted during the get).  Default value is false.
  • Label (for more info, see the tf label docs here)
    • LabelRecursive.  Passed to the Recursive property of the Label task.  If true (the default), the label operation will be recursive; otherwise, the label operation will only label top-level files and directories.
    • LabelChild.  Passed to the Child property of the Label task.  Valid values are Merge or Replace, with the default being Replace. 
    • LabelComment.  Passed to the Comment property of the Label task, this property controls the comment text used by the label operation.  Default value is "Label created by Team Build".
    • LabelName.  Passed to the Name property of the Label task, this property controls the name of the label generated by the label operation.  Default value is the build number.
    • LabelFiles.  Passed to the Files property of the Label task, this property controls the files labeled by the label operation.  Default value is "$/", or every file mapped in the workspace.
    • LabelScope.  Passed to the Scope property of the Label task, this property controls the scope of the label generated by the label operation.  Default value is "$/$(TeamProject)".

Team Build - Target Dependency Properties

Team Build - Target Dependency Properties

These are the properties used to set up the target dependency hierarchy in Team Build.  The can be modified to insert custom targets into the build process as an alternative to overriding the provided extensibility targets, but this should be done with care.  The standard pattern for overriding a dependency property is something like the following:

<PropertyGroup>

<DesktopBuildDependsOn>

PreDesktopBuildTarget;

$(DesktopBuildDependsOn);

PostDesktopBuildTarget;

</DesktopBuildDependsOn>

</PropertyGroup>

Note that the initial value of the property is preserved and new values are simply inserted before and after the existing ones, making sure to include semi-colons in all the appropriate spots.  For more information on these properties, you'll need to comb through the targets file - a full explanation of their functionality is beyond the scope of this blog post!

  • CleanDependsOn.
  • CleanAllDependsOn.
  • CleanCompilationOutputDependsOn.
  • CleanConfigurationDependsOn.
  • CleanSolutionDependsOn.
  • CompileDependsOn.
  • CompileConfigurationDependsOn.
  • CompileSolutionDependsOn.
  • ComputeSolutionListDependsOn.
  • CoreCompileDependsOn.  (This one is for backwards compatibility with TFS 2005 target overrides)
  • _CoreCompileDependsOn.  (This one is the new CoreCompileDependsOn for TFS 2008)
  • CoreCompileConfigurationDependsOn.
  • CoreCleanDependsOn.
  • CoreCleanAllDependsOn.
  • CoreCleanCompilationOutputDependsOn.
  • CoreCleanConfigurationDependsOn.
  • CoreCreateWorkItemDependsOn.
  • CoreDropBuildDependsOn.
  • CoreGetChangesetsAndUpdateWorkItemsDependsOn.
  • CoreGetChangesetsOnBuildBreakDependsOn.
  • CoreGetDependsOn.
  • CoreInitializeWorkspaceDependsOn.
  • CoreLabelDependsOn.
  • CoreOnBuildBreakDependsOn.
  • CoreTestDependsOn.
  • CoreTestConfigurationDependsOn.
  • CreateWorkItemDependsOn.
  • DesktopBuildDependsOn. 
  • DesktopRebuildDependsOn.
  • DropBuildDependsOn.
  • EndToEndIterationDependsOn.
  • GetChangesetsAndUpdateWorkItemsDependsOn.
  • GetChangesetsOnBuildBreakDependsOn.
  • GetDependsOn.
  • InitializeWorkspaceDependsOn.
  • LabelDependsOn.
  • OnBuildBreakDependsOn.
  • PostBuildDependsOn.
  • PreBuildDependsOn.
  • RunTestDependsOn.
  • TeamBuildDependsOn.
  • TestConfigurationDependsOn.
  • TestDependsOn.

Team Build - Extensibility Properties

Team Build Extensibility Properties

There are lots and lots of MSBuild properties available to Team Build 2008 build definitions, most of which are probably unknown to the majority of users.  As such, I've tried to compile a comprehensive list of these properties so that they can (hopefully) be more widely used.  I'll do the same thing at some point here for Team Build 2005.  If I've missed anything here or made any mistakes please let me know and I'll try and get them added/fixed.

Extensibility Properties

These are properties that are designed to be overridden by users, and they are already pretty well documented in MSDN here.  I've included the same properties here for comprehensiveness, along with some others not covered by the linked document:

  • AdditionalVCOverrides.  These values are written to the vsprops file generated by Team Build for each C++ project compiled and passed to the Override property of the VCBuild task.
  • BinariesSubdirectory.  The subdirectory under the build agent's working directory to which binaries are redirected during compilation.  Default value is "Binaries".
  • BuildConfigurationsInParallel.  Boolean property which, if true, enables building configurations (e.g. Debug|Any CPU and Release|Any CPU) in parallel, using MSBuild's multi-process capability.  Defaults to true.  Note that for this property to have an effect, the number of processes used by MSBuild, controlled by the MaxProcesses key in TfsBuildService.exe.config, must be set to a number greater than one.
  • BuildlogText.  The text that points to the build log in the work item created on a compilation failure.
  • BuildNumber.  The number of the build being built.  If you wish to override the default value, make sure to do so in the BuildNumberOverrideTarget so that the standard build process logic will update the various properties that depend on the build number (the drop location, label name, etc.) properly.
  • BuildSolutionsInParallel.  Boolean property which, if true, enables building solutions in parallel, using MSBuild's multi-process capability.  Defaults to true.  Note that for this property to have an effect, the number of processes used by MSBuild, controlled by the MaxProcesses key in TfsBuildService.exe.config, must be set to a number greater than one.
  • CleanCompilationOutputOnly.  Do not use this property directly - use IncrementaBuild and/or IncrementalGet instead.
  • CreateWorkspaceTaskComment.  The comment used when Team Build's workspace is created.  Default value is "Workspace created by Team Build".
  • CustomizableOutDir.  Set this property to true to keep Team Build from overriding the OutDir property for each solution/project in the SolutionToBuild item group. 
  • CustomizablePublishDir.  Set this property to true to keep Team Build from overriding the OutDir property for each solution/project in the SolutionToPublish item group.
  • CustomPropertiesForBuild.  Allows properties to be passed into all solutions/projects compiled during the course of the build.
  • CustomPropertiesForClean.  Allows properties to be passed into all solutions/projects cleaned during the course of the build.  Note that the Clean target of individual solutions/projects is only invoked if IncrementalBuild is true.
  • DescriptionText.  The history comment of the work item created on a compilation failure.
  • ErrorWarningLogText.  The text that points to the errors/warnings log file in the work item created on a compilation failure.
  • IncrementalBuild.  A boolean property that specifies whether the build should be full or incremental.  Defaults to false (i.e. a full build). 
  • IncrementalGet.  A boolean property that specifies whether the get operation should be full or incremental.  Defaults to false (i.e. a full get).
  • MSTestRefPath.  The path to the TestToolsTask (contained in Microsoft.VisualStudio.QualityTools.MSBuildTasks.dll).  Overridable so that the 8.0 version can be used for test assemblies compiled against the 8.0 unit test framework - see V8TestToolsTask.
  • RunCodeAnalysis.  Property that controls whether code analysis is executed according to project settings (Default), all the time (Always), or never (Never).
  • RunTest.  Boolean property that controls whether or not tests are executed.
  • SkipClean.  Do not use this property directly - use IncrementalGet and/or IncrementalBuild instead.
  • SkipDropBuild.  Set this property to true to skip the CoreDropBuild target.
  • SkipGet.  Set this property to true to skip the CoreGet target.
  • SkipGetChangesetsUpdateWorkItems.  Set this property to true to skip the association of changesets and work items for successful builds.
  • SkipInitializeWorkspace.  Do not use this property directly - use IncrementalGet and/or IncrementalBuild instead.
  • SkipInvalidConfigurations.  Set this property to false to generate an error rather than a warning when an invalid configuration is present in the ConfigurationToBuild item group for one or more solutions/projects.
  • SkipLabel.  Set this property to true to skip the CoreLabel target.
  • SkipPostBuild.  Do not use this property - use SkipGetChangesetsUpdateWorkItems instead.
  • SkipWorkItemCreation.  Set this property to true to skip the CoreCreateWorkItem target on a compilation failure.
  • SourcesSubdirectory.  The subdirectory under the build agent's working directory to which sources are retrieved from version control.  Default value is "Sources".
  • StopOnFirstFailure.  Set this property to true to stop cleaning, compiling, and/or testing on the first failure encountered.
  • TestResultsSubdirectory.  The subdirectory under the build agent's working directory to which test results are redirected.  Default value is "TestResults".
  • UpdateAssociatedWorkItems.  A boolean value that controls whether associated work items have their "Fixed In" field updated on a successful build.
  • UpdateAssociatedWorkItemsOnBuildBreak.  A boolean value that controls whether associated work items are updated for broken builds.  Default value is false.
  • V8TestToolsTask.  Boolean property which, if true, causes the 8.0 TestToolsTask syntax to be used (the TestNames property was not supported in the 8.0 version of the task).
  • VCBuildAdditionaLibPaths.  Passed to the AdditionalLibPaths property of the VCBuild task for each C++ project compiled.
  • VCBuildAdditionalOptions.  Passed to the AdditionalOptions property of the VCBuild task for each C++ project compiled.
  • VCBuildToolPath.  Passed to the ToolPath property of the VCBuild task for each C++ project compiled.
  • VCBuildUseEnvironment.  Passed to the UseEnvironment property of the VCBuild task for each C++ project compiled.
  • VCOverridesOpen.  The beginning of the vsprops file used to override VCBuild properties - can be overridden to use a different ProjectType version, a different Name, etc.  Default value is an escaped version of:

<?xml version="1.0"?>
<VisualStudioPropertySheet ProjectType="Visual C++" Version="8.00" Name="Team Build Overrides"

  • VCOverridesClose.  The ending of the vsprops file used to override VCBuild properties.  Default value is an escaped version of:

</VisualStudioPropertySheet>

  • WorkItemFieldValue.  The fields and values of the work item created on a compilation failure.
  • WorkItemTitle.  The title of the work item created on a compilation failure.
  • WorkItemType.  The type of work item created on a compilation failure.

Text To Speech Using .NET Framework 3.0 / 3.5

Text To Speech Using .NET Framework 3.0 / 3.5

What there is more to say, I used .NET Framework 3.0 to create a Text To Speech User Control.

CodePlex - Download Here (Include C# Source Code)

Windows Application

image 

Word 2007 Addin

image

Work Item Relation - Custom Control

Work Item Relation - Custom reControl

In Team System 2005/2008 the relation in Work Items is just a Link between Work  Item A to Work Item B.

There is not "Father" and "Child" relation, "Rosario" should bring us Traceability Matrix and "Father" and "Child" relations between Work Items, but this is a Major request from many customers that should be given right away.


I build very nice custom control that will manage relations between Work Items, So now you can enter to a Work Item and see hierarchy relation view from the "Father" to the "Child".

re

2

More Posts Next page »