Mike's profileFreeToDevBlogLists Tools Help

Blog


    November 27

    A new Home Page for the MSBuild Extension Pack

    A new homepage for www.msbuildextensionpack.com just went live. It’s fairly basic at the moment but we have some great things to come. The first new feature is online help. The help that is currently hosted is for version 3.5.1.0 which is in beta and due to ship on 1 Dec 2008.

    If you haven’t tried the beta yet, please give it a go and let us know how you get on. Please also feel free to comment on our online help. We will continue to ship a standalone chm file with each release.

    November 24

    MSBuild Extension Pack 3.5.1.0 Beta Released

    We expect to be in beta for 1 week (pending feedback) and to ship the 'stable' 3.5.1.0 release on 1 Dec 2008.

    What's New: Please consult the Version History page in the Help File for full details

    image

    Download

    November 21

    Team Foundation Server Build 2008 Reference DeskSheet – V2.0

    A few minor updates. A handy reference to aid your work with building software in TFS 2008

    ScreenShot023

    November 17

    Team Foundation Server Build 2008 Reference DeskSheet

    UPDATE: V2 is available now.

    A handy reference to aid your work with building software in TFS 2008

    image

    Download

    November 13

    Comments Blocked

    I’ve decided to disable comments on blog posts due to the high level of spam. If you need to contact me, use the ‘Send a Message’ link on this site. I believe that the new ‘Wave 3’ refresh of spaces will offer better spam controls, so I’ll re-enable comments when it is released.

    November 10

    Breaking Changes in Visual C# 2008 Service Pack 1

    I was made aware of an interesting site today that lists the breaking changes made to C# in VS2008 SP1. Usually people have problems with service pack installers rather than breaking changes, however it may be worth taking a read if you plan on upgrading.

    You can view the changes here.

    November 09

    User Interaction in MSBuild

    Although most MSBuild applications will happily run with no user interaction, sometimes it may be useful to prompt a user with a confirmation or request a value for use in further, possibly conditional, processing.

    In the following simple examples I’ll use a few tasks from the MSBuild Extension Pack to illustrate various options for interacting with the user.

    Note that many of the tasks used here provide additional properties for customising their usage. Please consult the latest help file for full details.

    Alert and Delay

    Although it requires no physical interaction from the user, a simple combination of playing a sound, displaying a message and then giving the user a chance to read the message can provide a simple but valuable user experience.

    Sample:

    <!-- Play an audible alert -->

    <MSBuild.ExtensionPack.UI.Console TaskAction="Beep" Repeat="10" Duration="5000" Frequency="1000"/>

    <!-- or play a custom sound -->

    <!-- <MSBuild.ExtensionPack.Multimedia.Sound TaskAction="Play" SoundFile="C:\Windows\Media\notify.wav" Repeat="10"/>-->

    <!-- Display a message -->

    <Message Text="Please take note of this important announcement" Importance="High"/>

    <!-- Give the user time to read the message -->

    <MSBuild.ExtensionPack.Framework.Thread TaskAction="Sleep" Timeout="5000"/>

     

    Console Interaction

    The Console class provides the ability to read a line of input from the user. This can also be used to pause the processing of the file until the user presses an [Enter] key.

    Sample:

    <!-- Play an audible alert -->

    <MSBuild.ExtensionPack.UI.Console TaskAction="Beep"/>

    <!-- Ask the user to press enter when ready to continue -->

    <MSBuild.ExtensionPack.UI.Console TaskAction="ReadLine" UserPrompt="Press [Enter] to continue..."/>

    <!-- Read input from the user -->

    <MSBuild.ExtensionPack.UI.Console TaskAction="ReadLine" UserPrompt="Please enter your Name and press [Enter]" ToUpper="true">

    <Output TaskParameter="UserResponse" PropertyName="Line"/>

    </MSBuild.ExtensionPack.UI.Console>

    <Message Text="The user name is: $(Line)"/>

    Output:

    C:\msbuild UserInteraction.proj

    Microsoft (R) Build Engine Version 3.5.30729.1

    Build started 09/11/2008 17:01:09.

    Project "C:\UserInteraction.proj" on node 0 (default targets).

      Press [Enter] to continue...

      Please enter your Name and press [Enter]

    mike

      The user name is: MIKE

    Done Building Project "C:\UserInteraction.proj" (default targets).

    Build succeeded.

     

    WinForm Interaction

    With so much console use in MSBuild, it can be a welcome break to switch to a Windows Form to interact with the user. The Dialog task provides a way for displaying prompts and gathering normal and sensitive input.

    Sample:

    <!-- A simple message -->

    <MSBuild.ExtensionPack.UI.Dialog TaskAction="Show" Text="Hello. Press OK to continue..."/>

    <!-- Give the user the option to cancel processing-->

    <MSBuild.ExtensionPack.UI.Dialog TaskAction="Show" Text="Click cancel if you've had enough..." Button1Text="Continue" Button2Text="Cancel" Title="You Decide!">

    <Output TaskParameter="ButtonClickedText" PropertyName="Clicked"/>

    </MSBuild.ExtensionPack.UI.Dialog>

    <Error Condition="$(Clicked) == 'Cancel'"/>

    <Message Text="User Clicked: $(Clicked)"/>

    <!-- A simple prompt for input -->

    <MSBuild.ExtensionPack.UI.Dialog TaskAction="Prompt" Title="Information Required" Button2Text="Cancel" Text="Please enter your Name below">

    <Output TaskParameter="ButtonClickedText" PropertyName="Clicked"/>

    <Output TaskParameter="UserText" PropertyName="Typed"/>

    </MSBuild.ExtensionPack.UI.Dialog>

    <Message Text="User Clicked: $(Clicked)"/>

    <Message Text="User Typed: $(Typed)"/>

    <!-- A prompt for password input -->

    <MSBuild.ExtensionPack.UI.Dialog TaskAction="Prompt" Title="Sensitive Information Required" Button2Text="Cancel" Text="Please enter your Password below" MessageColour="Red" MaskText="true">

    <Output TaskParameter="ButtonClickedText" PropertyName="Clicked"/>

    <Output TaskParameter="UserText" PropertyName="Typed"/>

    </MSBuild.ExtensionPack.UI.Dialog>

    <Message Text="User Clicked: $(Clicked)"/>

    <Message Text="User Typed: $(Typed)"/>

    <OnError ExecuteTargets="ErrorTarget"/>

    Output:

    clip_image002

    clip_image004

    Assuming I click Cancel, then all processing would stop:

     

    C:\msbuild UserInteraction.proj

    Microsoft (R) Build Engine Version 3.5.30729.1

    Build started 09/11/2008 17:01:09.

    Project "C:\UserInteraction.proj" on node 0 (default targets).

      The user has terminated processing.

    Done Building Project "C:\UserInteraction.proj" (default targets). -- FAILED

    Build FAILED.

    If I clicked continue, we would see

    clip_image006

    clip_image008 

     

    Full Sample

    <Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <PropertyGroup>

    <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>

    <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>

    </PropertyGroup>

    <Import Project="$(TPath)"/>

    <Target Name="Default">

    <!-- Play an audible alert -->

    <MSBuild.ExtensionPack.UI.Console TaskAction="Beep" Repeat="10" Duration="5000" Frequency="1000"/>

    <!-- or play a custom sound -->

    <!-- <MSBuild.ExtensionPack.Multimedia.Sound TaskAction="Play" SoundFile="C:\Windows\Media\notify.wav" Repeat="10"/>-->

    <!-- Display a message -->

    <Message Text="Please take note of this important announcement" Importance="High"/>

    <!-- Give the user time to read the message -->

    <MSBuild.ExtensionPack.Framework.Thread TaskAction="Sleep" Timeout="5000"/>

    <!-- Play an audible alert -->

    <MSBuild.ExtensionPack.UI.Console TaskAction="Beep"/>

    <!-- Ask the user to press enter when ready to continue -->

    <MSBuild.ExtensionPack.UI.Console TaskAction="ReadLine" UserPrompt="Press [Enter] to continue..."/>

    <!-- Read input from the user -->

    <MSBuild.ExtensionPack.UI.Console TaskAction="ReadLine" UserPrompt="Please enter your Name and press [Enter]" ToUpper="true">

    <Output TaskParameter="UserResponse" PropertyName="Line"/>

    </MSBuild.ExtensionPack.UI.Console>

    <Message Text="The user name is: $(Line)"/>

    <!-- A simple message -->

    <MSBuild.ExtensionPack.UI.Dialog TaskAction="Show" Text="Hello. Press OK to continue..."/>

    <!-- Give the user the option to cancel processing-->

    <MSBuild.ExtensionPack.UI.Dialog TaskAction="Show" Text="Click cancel if you've had enough..." Button1Text="Continue" Button2Text="Cancel" Title="You Decide!">

    <Output TaskParameter="ButtonClickedText" PropertyName="Clicked"/>

    </MSBuild.ExtensionPack.UI.Dialog>

    <Error Condition="$(Clicked) == 'Cancel'"/>

    <Message Text="User Clicked: $(Clicked)"/>

    <!-- A simple prompt for input -->

    <MSBuild.ExtensionPack.UI.Dialog TaskAction="Prompt" Title="Information Required" Button2Text="Cancel" Text="Please enter your Name below">

    <Output TaskParameter="ButtonClickedText" PropertyName="Clicked"/>

    <Output TaskParameter="UserText" PropertyName="Typed"/>

    </MSBuild.ExtensionPack.UI.Dialog>

    <Message Text="User Clicked: $(Clicked)"/>

    <Message Text="User Typed: $(Typed)"/>

    <!-- A prompt for password input -->

    <MSBuild.ExtensionPack.UI.Dialog TaskAction="Prompt" Title="Sensitive Information Required" Button2Text="Cancel" Text="Please enter your Password below" MessageColour="Red" MaskText="true">

    <Output TaskParameter="ButtonClickedText" PropertyName="Clicked"/>

    <Output TaskParameter="UserText" PropertyName="Typed"/>

    </MSBuild.ExtensionPack.UI.Dialog>

    <Message Text="User Clicked: $(Clicked)"/>

    <Message Text="User Typed: $(Typed)"/>

    <OnError ExecuteTargets="ErrorTarget"/>

    </Target>

    <Target Name="ErrorTarget">

    <Message Text="The user has terminated processing."/>

    </Target>

    </Project>

    November 08

    TFS Power Tools October 2008

    These have just been released… Available here

    November 01

    Progress on release 3.5.1.0

    Progress on the next release, release 3.5.1.0, of the MSBuild Extension Pack is going well.

    Please continue to provide feedback to us via the Discussions and Issue Tracker pages, or email us directly at feedback@msbuildextensionpack.com

    We aim to ship 3.5.1.0 in the last week of November / first week of December 2008.