TechDays 2014 (SWE) – Från kod till produktion på 60 minuter

I höst är det dags för nästa TechDays i Sverige, denna gång 18-20 november på Kistamässan i Stockholm.

Själv har jag förmånen att hålla ett pass om releasehantering som specifikt kommer att handla om hur man med hjälp av senaste versionen av Visual Studio kan sätta upp en releaseprocess på ett väldigt smidigt sätt. Vi kommer gå igenom hela flödet från kod till release och även få med stödjande tekniker som automatiserad testning och miljöhantering.

Info om sessionen hittar du här: http://www.techdays.se/Program/Sessioner/Fran-kod-till-produktion-pa-60-minuter-eller-hur-du-med-hjalp-av-Release-Management-for-Visual-Studio-kan-implementera-en-automatiserad-releaseprocess

Har du idéer på saker du skulle vilja se mer av inom release management så skriv en kommentar.

image

Implementing a password field in a TFS build definition

Here’s another TFS build related thing I’ve been asked on and off and still cannot find a sample on the web to refer to.

The scenario in this case is pretty obvious; we want a field in a TFS build definition to hold sensitive information that shows a character mask instead of the text value in clear text, i.e. the Password field in the image below:

image

Click on the […] button and a custom dialog is shown where we type in the password:

image

In this example I’ve chosen an approach where the build template is extended with a custom argument type representing the sensitive value and displays a custom formatted string instead of the underlying value. The value is edited using a custom editor in the build definition. This is a technique that’s been around since TFS 2010 and Jason Pricket has written a post on the basics of creating a custom editor (http://blogs.msdn.com/b/jpricket/archive/2010/01/18/tfs-2010-custom-process-parameters-part-3-custom-editors.aspx) a long time ago.

You need to create a custom TFS build activity to hold the code for the extension. If you want to learn how to create a TFS build activity see http://msdn.microsoft.com/en-us/library/hh850441.aspx for an example. The custom activity in this example is in the Solidify.RM.Build.Activity namespace.

First add a class in the custom activity to hold the password field. Mark the class Serializable and I also use field attributes to provide a display name and set the RefreshProperties to All (this will make the grid in the build definition refresh when the underlying value changes).

The real logic in this extension is to override the ToString method that renders the value as stars instead of the sensitive string. Here’s the code for the password field:

[Serializable]

public class PasswordField

{

   [DisplayName("Password"), RefreshProperties
    (System.ComponentModel.
RefreshProperties.All)]

   public string Value { get; set; }

 

   public override string ToString()

   {

      if (this.Value != null)

      {

         return new string(‘*’, this.Value.Length);

      }

      return string.Empty;

   }

}

Next add a WinForm dialog to the activity that will be used to capture the password, something like this will do fine:

image

Here’s the simple code for the dialog:

public partial class PasswordDialog : Form

{

   public PasswordDialog(string password)

   {

      InitializeComponent();

      passwordTextBox.Text = password;

   }

 

   public string Password

   {

      get

      {

         return passwordTextBox.Text;

      }

 

      set

      {

         passwordTextBox.Text = value;

      }

   }

 

   private void okButton_Click(object sender, EventArgs e)

   {

      this.DialogResult = DialogResult.OK;

      this.Close();

   }

 

   private void cancelButton_Click(object sender, EventArgs e)

   {

      this.DialogResult = DialogResult.Cancel;

      this.Close();

   }

}

Then to connect the dialog to the build process parameter we need a custom UITypeEditor to display the dialog. The code for the UITypeEditor is more or less boilerplate code in this case, it takes a PasswordField argument as an obect parameter and initializes the PasswordDialog with that value. The we pick up the result and assign it back to the process parameter.

public class PasswordEditor : UITypeEditor
{
   public override object EditValue(ITypeDescriptorContext 
          context,
IServiceProvider provider, object value)
  
{
      if (provider != null)
     
{
         var editorService = (IWindowsFormsEditorService)
         provider.GetService(
typeof(IWindowsFormsEditorService));
         if (editorService != null)
        
{
           
var password = value as PasswordField;
           
using (var dialog = new PasswordDialog
                                    (password.Value))
           
{
               dialog.Password = password.Value;
              
if (editorService.ShowDialog(dialog) ==
                   DialogResult.OK)
              
{
                  password.Value = dialog.Password;
              
}
           
}
        
}
      }
      return value;
   }

   public override UITypeEditorEditStyle GetEditStyle
                   (
ITypeDescriptorContext context)

   {
     
return UITypeEditorEditStyle.Modal;
   } 
}

That’s the custom activity part. Next we need to customize a build definition to use the password type. First add a new argument to the build process of type Solidify.RM.Build.Activity.PasswordField. I also initialize the argument with a new object of the same type to make sure it’s always defined:

image

Then configure the metadata for the password argument, this is where we bind the argument to the custom editor. The important detail here is to provide the password editor using the full name of the type and assembly (Solidify.RM.Build.Activity.PasswordEditor,Solidify.RM.Build.Activity):

image

Finally use the password field as desired in the build template, save, check in the customized template into TFS and you’re ready to go.

How to add an enum to a TFS build definition

Recently I was asked how you go about to create an enum/drow-down argument in a TFS build definition. It’s actually a quite easy thing to solve and requires very little code. But it does require a fair bit of plumbing and since I didn’t find an example on how to do this I’m posting the steps here.

This is the scenario: I want a drop-down argument in my build definition that’s bound to an enum value, i.e. let me select the build status from a known set of values:

image

First add an enum to a TFS build activity:

image

I’m assuming you’re familiar with the process of TFS build extensibility. If you need an example of how to create a TFS build activity see http://msdn.microsoft.com/en-us/library/hh850441.aspx for an example.

Next add an argument of the BuildStatusEnum type to your build definition:

image

To get the enum to show as drop-down you need to add metadata to render it correctly. Open the metadata editor in from the Metadata argument and add the BuildStatus argument as a parameter. Then specify Microsoft.TeamFoundation.Build.Controls.EnumPropertyEditor, Microsoft.TeamFoundation.Build.Controls as the Editor, this does the trick of rendering the enum as a drop-down in the build definition process later on. The EnumPropertyEditor is one of the built-in editors which is convenient to use instead of implementing this logic yourself. If you’re curious of what other editors there are then take a look at this post http://bartwullems.blogspot.se/2012/07/tfs-build-using-built-in-editors.html and dig deeper by using a .NET reflection tool to investigate the code.

image

That’s all you need to do to setup the design time experience, now you can go on and use the enum in the build definition as you intend to.

image

WitCustomControls for 2013 Update 2 released

We’ve added a 1.2.2.0 release at https://witcustomcontrols.codeplex.com/ to fix an issue caused by changes in the jscript structure in TFS 2013 Update 2.

Release Notes

This release contains the following changes:

Download the latest release here: https://witcustomcontrols.codeplex.com/releases/view/123638.

Presentation från “Har du en DevOps i ditt team?” (SWE)

Tack alla som kom, bra diskussioner om ett i mitt tycke viktigt ämne!

Nu finns presentation från seminariet uppe på SlideShare: http://www.slideshare.net/Solidify-Sverige/solidify-dev-ops

Nästa gång kör vi i Göteborg (den 12 september). Passa på att boka dig om du vill komma och lära dig mer om DevOps rollen och hur Visual Studio 2013 ALM hjälper dig bli mer effektiv i teamet. Info och registrering på http://informator.se/seminarier/seminarier/har-du-en-devops-i-ditt-team.

Har du en DevOps i ditt team? (SWE)

Vill du kunna leverera mjukvara snabbare utan att förlora kvalitet? Då ska du komma till vårt seminarium om DevOps där vi förklarar hur denna roll kan hjälpa teamet styra upp sina leveranser så flödet från utveckling till test till produktion flyter på ett effektivt sätt.

Vi baserar såklart lösningen på senaste tekniker från Microsoft, bland annat Visual Studio 2013, TFS 2013, Microsoft Azure, PowerShell och Microsoft Release Management.

Den 10 juni kör vi i Stockholm och 12 september i Göteborg.

För mer information och bokning: http://informator.se/seminarier/seminarier/har-du-en-devops-i-ditt-team

image

New book: Team Foundation Server 2013 Customization

I had the pleasure reviewing this great book on TFS customization by Gordon Beeming. It’s a short book (just the way we come to expect from the PACKT series) but it covers a big topic and in a very efficient way. Just look at the TOC:

  • Customizing TFS process templates
  • Customizing TFS Web Access
  • Creating custom work item controls
  • Creating service-side plugins
  • Creating TFS scheduled jobs
  • Customizing the TFS Build process

Not bad for a 82 pages book! I warmly recommend this nugget to anyone interested in learning more about how to extend and customize a TFS server.

image

Read more and order: http://www.amazon.com/Team-Foundation-Server-2013-Customization-ebook/dp/B00HYTDXJU

Visual Studio Lab Management Guide v3 Released!

I’ve been involved in this ALM Rangers project for a long time and I’m happy to announce the release of the third edition of the guide!

image

The updated guide includes new content on:

  • New capabilities for Lab Management using TFS 2013
  • Best-practices for upgrading Lab Management and lab environments
  • Using Windows Azure IaaS for lab environments

The guide is also considerably shorter, we’ve made great efforts to reduce the page count by removing obsolete content and referencing resources available on MSDN.

Download: https://vsarlabman.codeplex.com/releases/view/118041

A big thanks to the team who make this release possible!

Brian Minisi, Dave McKinstry, John Bergman, Mike DouglasMichael Fourie, Mathias Olausson, Richard Fennell, Vijay Machiraju  and Willy-Peter Schaub.

Visual Studio 2013 ALM Launch Event (Swe)

Visual Studio 2013 markerar ännu ett stort steg mot en integrerad utvecklingsplattform för hela utvecklingsprojektet.

För att ge dig en tidig inblick i vad som kommer i den nya versionen bjuder vi på Solidify tillsammans med Microsoft in till ett gratis lanseringsvent!

Under seminariet går vi igenom hur en typisk iteration i ett projekt kan se ut om man använder Visual Studio 2013 ALM.

  • Agile planning. I TFS 2013 är det mycket fokus på storskalig användning av agila tekniker. Vi kommer visa nyheter som Enterprise Agile features, Team Rooms och work item charting.
  • Utveckling. Ur ett ALM-perspektiv finns det självklart en hel del nyheter för utvecklaren. Här tittar vi på bland annat stöd för Git som versionshanterare, nya funktionerna Code Lense, peek definition och en ny funktion för kodkommentering.
  • Testning. Äve inom test hittar vi en hel del nyheter, exempelvis en web-baserad testfallshantering, Coded UI för store apps, Azure load testning.
  • Release management. Sist men inte minst knyter vi ihop säcken och tittar på bygg och releasehantering. En stor del av detta är baserat på det nyinköpta verktyget ”InRelease” som på ett mycket bra sätt integrerar TFS byggsystem med en helhetslösning för releasehantering

Tid och plats

  • Onsdag 27/11, 13-16, Malmö, Elite Hotel Residens. Klicka här för att anmäla dig.
  • Torsdag 28/11, 9-12, Göteborg, IHM Business School. Klicka här för att anmäla dig.
  • Fredag 29/11, 9-12, Stockholm, Microsoft Akalla. Klicka här för att anmäla dig.

Mer information om evenemanget: https://bitly.com/vsalm2013launch.

WitCustomControls for Visual Studio 2013 released!

Last week we published the 1.2.0.0 release of the WitCustomControls. This time Stéphane Lagacé has done most of the work of by updating the MultiValueControl with autocompletion and data binding. I’ll cover these features in a later post.

Other than the work from Stéphane, the controls have been recompiled against the 2013 assemblies.

The control pack contains the following work item custom controls:

  • MultiValueControl: a ComboBox to accept and show multiple values for a field by showing a list of checkboxes. More details here: MultiValue Control
  • ScreenshotControl: a simple control (button) to capture a screenshot as a work item attachment. More details here: Screenshot controls.
  • AttachmentsControl: this control cab be used as an alternative to the standard file attachments dialog. More details here: Screenshot controls.
  • WebBrowserControl: displays a web browser inside a work item. More details here: Web browser control.
To install the files, download the file matching your TFS version. For TFS 2012 and 2013 the .zip file contains an installer for the Windows controls and a .zip file for the Web Access controls.

Download the controls here.

Network-wide options by YD - Freelance Wordpress Developer