Private Builds in TFS

My team has configured TFS to automatically kick-off continuous integration (CI) builds when developers check-in changes. The build depends on the affected area, and the time to complete depends on the build. Some of our builds contains hundreds of projects and thousands of unit tests, and these can take the better part of an hour to complete. We also have nightly builds that build even more and take even longer.

Occasionally, I’ll have some changes to check-in at the end of the day. I check them in, and I get a notification that I broke the build when I’m halfway home. Crap. I need to fix the change before the nightly build starts, or it’s going to break, too.

Wouldn’t it be great if there was a way to run a build with my pending changes and then check them in automatically if the build succeeds? Well… There is! TFS has support for private builds (or “buddy builds”) that you can queue with a shelveset.

When I choose to queue a build, I choose to build with local sources plus a shelveset. Then I specify which shelveset, and I have the option to check-in my changes if the build succeeds. Splendid!

Advertisement

Awesome, Free Software: Core FTP

I had to do some testing for a project that uploads its payload via SFTP. I wanted to setup a basic, no-frills SFTP server that could accept my files. I did a quick Google search and found Core FTP Server–a free download. After about 2 minutes of configuration, I had my SFTP server up & running; it was fantastic.

I also see that they have a free mini sftp server that’s available. It’s a no-install, one-user, one-directory SFTP server, and IT WORKS AWESOMELY! This might be my new favorite way to securely transfer files between sites!

Core FTP Server

XmlSerializer and Namespaces

Need to share some data with another system/program/thing? XML files are a great, easy way to do it! Typically, my process for creating or consuming XML files will be to generate a class from an XML schema definition (XSD) and then serialize to and deserialize from XML as needed.

Usually, you don’t need to do anything above and beyond this, but from time to time you might need to do some additional manipulation with the XML namespaces and associated prefixes. The XmlSerializer class gives you a lot of flexibility to do this, and it’s really easy! Here are some different things you can do along with the output produced.

Here’s my no-frills Person class that I’ll be serializing to XML in the examples that follow:

[XmlType(Namespace = "http://adamprescott/sample")]
public class Person
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public DateTime? DateOfBirth { get; set; }
}

By default, the serializer will include the XML namespace on each element.

var p = new Person
    {
        LastName = "Sample",
        FirstName = "James Q.",
        DateOfBirth = new DateTime(1970, 1, 1),
    };
var serializer = new XmlSerializer(typeof(Person));
serializer.Serialize(Console.Out, p);
<?xml version="1.0"?>
<Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <FirstName xmlns="http://adamprescott/sample">James Q.</FirstName>
  <LastName xmlns="http://adamprescott/sample">Sample</LastName>
  <DateOfBirth xmlns="http://adamprescott/sample">1970-01-01T00:00:00</DateOfBirth>
</Person>

Whoa-day! That’s pretty busy. You can clean it up a lot just by declaring the default namespace when you instantiate your XmlSerializer.

var p = new Person
    {
        LastName = "Sample",
        FirstName = "James Q.",
        DateOfBirth = new DateTime(1970, 1, 1),
    };
var serializer = new XmlSerializer(typeof(Person), "http://adamprescott/sample");
serializer.Serialize(Console.Out, p);
<?xml version="1.0"?>
<Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://adamprescott/sample">
  <FirstName>James Q.</FirstName>
  <LastName>Sample</LastName>
  <DateOfBirth>1970-01-01T00:00:00</DateOfBirth>
</Person>

That’s a little nicer, but what if I don’t want those XMLSchema namespaces? That’s easy, too!

var p = new Person
    {
        LastName = "Sample",
        FirstName = "James Q.",
        DateOfBirth = new DateTime(1970, 1, 1),
    };
var serializer = new XmlSerializer(typeof(Person), "http://adamprescott/sample");
var namespaces = new XmlSerializerNamespaces();
namespaces.Add(string.Empty, "http://adamprescott/sample");
serializer.Serialize(Console.Out, p, namespaces);
<?xml version="1.0"?>
<Person xmlns="http://adamprescott/sample">
  <FirstName>James Q.</FirstName>
  <LastName>Sample</LastName>
  <DateOfBirth>1970-01-01T00:00:00</DateOfBirth>
</Person>

Note that I made the prefixes all string.Empty. If I were to specify a prefix, it would be included in the serialized XML.

var p = new Person
    {
        LastName = "Sample",
        FirstName = "James Q.",
        DateOfBirth = new DateTime(1970, 1, 1),
    };
var serializer = new XmlSerializer(typeof(Person));
var namespaces = new XmlSerializerNamespaces();
namespaces.Add("ap", "http://adamprescott/sample");
serializer.Serialize(Console.Out, p, namespaces);
<?xml version="1.0"?>
<Person xmlns:ap="http://adamprescott/sample">
  <ap:FirstName>James Q.</ap:FirstName>
  <ap:LastName>Sample</ap:LastName>
  <ap:DateOfBirth>1970-01-01T00:00:00</ap:DateOfBirth>
</Person>

Move Shelvesets Between Branches in TFS

At my company, we do a lot of concurrent development between a number of branches. It’s not uncommon for a change made in one branch to be needed in another branch. TFS Power Tools includes functionality to help you quickly and easily migrate a shelveset from one branch into another.

The usage is simple, too. Go to the command-line and type the following (make sure you run it from a directory mapped to a workspace):

tfpt unshelve "My Shelveset" /migrate /source:$/SourceBranch /target:$/TargetBranch

When you run the command, it will load the changes stored in the shelveset into the specified target branch. Super!

AVG Free Edition

If anybody asks me for recommendations on an anti-virus solution, I always point them to AVG. I’ve used it for years and love it. It has a great UI, does a good job detecting and cleaning viruses, and they have a free edition to-boot! The only drawback to the free edition is that it’s so hard to find the download!

If you try to find it by browsing through http://www.avg.com, it’s near impossible to find. So, the easiest way to find it is to remember this URL: free.avg.com.

If you do happen to download and/or install the not-free version, it will prompt you to convert to the free version when you go to uninstall. So that’s another way to get it.

Bright Future for WP7

Microsoft has come out with a list of new features that will be coming with the Mango update later this year. I gotta say, I’m really excited. I’m happy with the phone exactly how it is now, but it’s getting so much better. You can find feature/update lists all over the internet, or you can browse the What’s next | Windows Phone 7 page at Microsoft.

These are the features that I’m most excited about:

  • IE9
  • Voice turn-by-turn navigation
  • Bing Vision
  • Local Scout
  • Better integration with Twitter & support for Facebook chat
  • Improved multitasking (alt+tab-like behavior)

The only feature that I was really missing from the BlackBerry Curve that I had with Sprint is the Sprint Navigation app. It was nice to always have a GPS in my pocket. WP7 has Bing maps with directions, but it’s not the best for figuring out where to go while driving since you need to scroll through and read the steps. So I’m definitely happy to see that voice-guided turn-by-turn directions are coming. I’m also looking forward to trying out Bing Vision.

Also, the check out PC Magazine’s 2011 Readers’ Choice Awards for mobile phones here. The Samsung Focus on AT&T (my phone) had a sparking 9.1 rating. I agree with it–I love this phone!

Goodbye .net Reflector, Hello ILSpy

I love[d] RedGate’s .net Reflector and used it all the time. It made me sad to see that they decided to eliminate the free version. The price isn’t terrible at $35, but it’s enough to make me explore other options before putting in a purchase request at work. I talked to some colleagues, did some quick Google research, and was pleasantly surprised to find a wonderful substitute called ILSpy.

ILSpy does exactly what .net Reflector did for me. I can explore objects, methods, and properties in assemblies, and it’ll decompile to show implementation details. ILSpy (or something similar, like .net Reflector) is a must-have tool for debugging and troubleshooting. I definitely recommend you check it out!

More info here.

‘Must Have Games’ for Windows Phone 7 Schedule

The schedule has been announced for Microsoft’s ‘Must Have Games’ promotion that will bring popular games like Angry Birds and Plants vs. Zombies to Windows Phone 7.

Here’s the schedule:
* May 25: Hydro Thunder GO! – $4.99
* June 1: Doodle Jump – $2.99
* June 8: geoDefense – $2.99
* June 15: Sonic the Hedgehog 4: Episode 1 – $6.99
* June 22: Plants vs. Zombies – $4.99
* June 29: Angry Birds – $2.99

Really looking forward to getting Sonic & Plants vs. Zombies! Hooray!!

More info here.

Getting Started with HTML5

I know that HTML5 has been out there for some time, and I’ve been meaning to check it out and start experimenting with it for months (nay, years!). This morning, I got around to looking into it and found what looks like a good collection of tutorials & resources.

Learn HTML5: 10 Must Read Lessons

This is where I’m going to start–more on this later!

%d bloggers like this: