Geek Noise
Rants, rambles, news and notes by Peter Provost
26

Extending Visual Studio 2010 UML Designers – Part 1: Getting Started

Monday, 26 October 2009 10:28 by Peter Provost

This is the first in a series of blog posts to show how the new UML Modeling capabilities in Visual Studio 2010 Ultimate can be extended. Later articles will expand on the examples shown here and show more advanced extensibility.

Introduction

In Visual Studio 2010 Ultimate we have introduced a set of new UML 2.1.2 modeling capabilities. We include designers for producing five UML diagram types:

  • Class Diagram
  • Sequence Diagram
  • Component Diagram
  • Use Case Diagram
  • Activity Diagram

In addition, we also have tools for analyzing, documenting and validating your architecture. The Layer Diagram can be used to define the large layered components on your solution, map them to real code elements and later validate that your as-built system conforms to what you planned. If you have existing systems you want to investigate and understand better, we have the Architecture Explorer and a set of Dependency Graphs that you can create to see how the parts come together.

As we were building our new capabilities, we realized that people would need to be able to add new capabilities to the diagrams and models we’re including in the box. You may, for example, want to add a command for refactoring the model to the menu that appears when you right click on on a shape on the Class Diagram. Or perhaps you want to be able to drag-and-drop something onto a diagram and have it create new model elements based on the source of the drag. Or maybe your enterprise has guidelines about what makes a model “valid” and want to code those validation constraints into the tool so you know when you have deviated.

We can support all of those scenarios using very simple extensibility mechanisms that are present in Visual Studio 2010 Ultimate.

Before You Begin

This series of articles assumes you already have Visual Studio 2010 Beta 2 Ultimate installed on your system. To make our lives a lot easier we will also be using the Visual Studio 2010 Beta 2 SDK to get our projects started, installed and debugged.

In case you are missing any of those, you can find links to all of the downloads on the Visual Studio 2010 and .NET Framework Beta 2 Landing Page.

Creating Your First Extension Project

Visual Studio 2010 uses the Managed Extensibility Framework for lightweight extensibility and we were eager adopters of that when we created our own extensibility hooks. What this means is that to create a new UML Designer extension, you create a new VSIX Project (a VSIX is just a ZIP file that tells Visual Studio how to install the extension…see What is a VSIX? for more information) and then add a simple little MEF component to it. Easy pie. So let’s get started…

Creating the VSIX Project

Before we can get into the extension itself, we need to get our project set-up correctly.

  1. Create a new C# VSIX Project (you can do VB if you want but my code here is in C#). File | New | Project | Visual C# | Extensibility | VSIX Project.
  2. Add references to the following .NET Assemblies:
    • Microsoft.VisualStudio.Modeling.Sdk.10.0
    • Microsoft.VisualStudio.Uml.Extensions
    • Microsoft.VisualStudio.Uml.Interfaces
    • System.ComponentModel.Composition
  3. Open source.extension.vsixmanifest in the editor. (If it opens in an XML editor, close it and choose View Designer from the file context menu).
  4. Fill in the Name, Author, and Description sections.
  5. Set “Supported VS Editions” to Visual Studio Ultimate.
  6. Save all open files and close them.
  7. Delete the file VSIXProject.cs from the project

VSSDK Beta 2 Bug Workarounds

Unfortunately there are a couple of bugs in the current VSSDK Beta 2 that we have to work around. I’ve been told they will be fixed in an update release but until then, let me take you through the project cleanup required to make this work:

Step 1 – Tweak the .csproj file

  1. Right click on your project and choose “Unload Project”.
  2. Right click again on your project and choose “Edit Yourprojectname.csproj”
  3. In the topmost property group, look for the XML tag <IncludeAssemblyInVSIXContainer>. It will be set to false. Change it to true.
  4. Save the .csproj file and reload it into Visual Studio.

Step 2 – Tweak the .vsixmanifest file

  1. Right click on the file “source.extension.vsixmanifest” and choose View Code
  2. At the bottom of the file in the section called <Content> add the following line. (Yes, those vertical bars are important.)
    <MefComponent>|Yourprojectname|</MefComponent> 
  3. Save and close the file.

Say “Hello World!”

Now let’s make this thing fly. We won’t get into any complicated UML or model manipulation in this article. Instead we will just add a new menu item to the context menu of the UML Class Designer. When clicked, the menu item will say Hello World.

  1. Add a Project Reference to System.Windows.Forms (a simple way to get a MessageBox).
  2. Add a new class named HelloWorldCommandExtension.cs to the project
  3. Have your new class implement the ICommandExtension interface and add the following attributes to your class (you will need to add the required using directives):
    [Export(typeof(ICommandExtension))] 
    
    [ClassDesignerExtension] 
  4. Delete the body of the QueryStatus method
  5. Replace the Text property implementation as shown here:
    public string Text
    
    {
    
        get { return "Hello World!"; }
    
    }
    
  6. Replace the Execute method as follows:
    public void Execute(IMenuCommand command)
    
    {
    
        System.Windows.Forms.MessageBox.Show("Hello World!");
    
    }

Testing Your Extension

The nice thing about using the VSIX project template is that is sets everything up for debugging and testing for you using the Visual Studio Experimental hive. To run your extension without debugging, press Ctrl+F5. To run with debugging enabled, just press F5.

One the Experimental Hive is up and running, create a new Modeling Project, add a new Class diagram, and right click on the surface. You should see your “Hello World!” menu item and choosing it should display the message box. Voila!

Next Steps

In the next part of this series, I will show you how to create new model elements in the Model Store and display them on the diagram surface. Subsequent articles will explore other diagram types and more complex scenarios including creating a full VSPackage.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   , , ,
Categories:   Technology
Actions:   E-mail | del.icio.us | Permalink | Comments (10) | Comment RSSRSS comment feed
19

Visual Studio 2010 and .NET 4.0 Beta 2 LIVE on MSDN

Monday, 19 October 2009 03:32 by Peter Provost

VS-2010-dotNet4-LogoThis morning we released to MSDN the Beta 2 release of Visual Studio 2010 and .NET Framework 4.0 to MSDN. See Soma’s blog post for the official bits.

There is so much good stuff coming in Beta 2 it is hard to keep track of it all. Over in the Arch Tooling team where I work, we’ve done a ton of work on increasing the performance of the UML, Layer and Architecture designers we’ve made. We have also added a BUNCH of new and cool MEF-based extensibility hooks into our designers so customers can add new and interesting features that we may not have thought of.

We’ve been dogfooding this release (client and server) internally for quite a while now and I have to say I really like it. It feels good, it looks good and it does what I want to do.

Probably the biggest thing people will talk about initially, however is the new SKU changes we’re making in 2010. I remember way back before I joined Microsoft I criticized the “role-based” SKU system as not actually aligning with how real teams get work done. As Brian Harry explains on his SKU changes post, we’ve fixed that by adopting a SKU system very similar to that used by Windows and Office:

  • Microsoft Visual Studio 2010 Ultimate with MSDN: the comprehensive suite of application lifecycle management tools for software teams to ensure quality results from design to deployment.
  • Microsoft Visual Studio 2010 Premium with MSDN: a complete toolset for developers to deliver scalable, high quality applications.
  • Microsoft Visual Studio 2010 Professional with MSDN: the essential tool for professional development tasks to assist developers in implementing their ideas easily.

As you can see this is a much cleaner SKU model and we’re excited to see how customers respond.

This Beta 2 release is available on MSDN subscriber downloads NOW and will be generally available on Wednesday October 21. .NET Framework Beta 2 will be released in English, Japanese, German and Arabic.  VS Beta 2 will be released in English, Japanese, and German.

There have also been a bunch of updates recently to the Microsoft Developer Network (MSDN) website. A serious design update and ton of new social networking features should help people get the information they need faster than ever. Scott Hanselman blogged about it last week.

We all hope you try this release out and give us tons of feedback on how it works for you and your business.

Edit: Added link to Brian Harry’s SKU post and some descriptive content about the SKUs.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   ,
Categories:   Technology
Actions:   E-mail | del.icio.us | Permalink | Comments (1) | Comment RSSRSS comment feed
14

New Gaming PC Build-out – Final Results

Wednesday, 14 October 2009 04:19 by Peter Provost

Close up of the case and internals It has been all done for a little over a week, and I love it. As I said in my last post, I decided, for the first time in almost 20 years, to build a machine from scratch for my home-office. I spent a bunch of time chatting with friends at work and who I play World of Warcraft with, and I think I ended up with a pretty kicking kit.

The order came in 5 shipments, which had me a bit freaked out that 4 would arrive and the CPU would be a day late stuck in Kansas, but that didn’t happen. The whole thing arrived on time, and in one big pile of boxes. In addition to the order I described last time, I also ordered another Dell E228WFP to go with the one I already had.

Construction of the machine was painless. Far more painless than I thought it would be. I was a bit worried about screwing it up, so I went pretty slowly. Opened each box, looked at what was there, set the instructions aside, etc.

The case is pretty big. It has four fans, including a big 200mm one in the top. You’d think it would be loud, and I guess it is louder than my laptop was, but I don’t find it distracting.

First thing to go in was the motherboard. I decided to put the mobo in before installing the CPU and memory and probably would do it that way next time too. Brad Wilson suggested doing the CPU and RAM on my desk to make it easier, but I figured moving that sucker around all loaded up would suck.

The mobo has tons of ports (USB, eSATA and more) on the back and came with a little panel that slides into a slot on the case to expose all the ports. That was nice and simple. Motherboard slid right in, crewed it down and moved on to the next step.

I bought a 750W power supply. Some would say that is too big, but the graphics card claimed that I needed a minimum 550W supply and the motherboard/CPU wanted 140W so I didn’t want to come up short. It came in a velvet bag like a bottle of Crown Royale, which made my laugh. Tons of connectors on it, which is great. Dropped right in, no issues. On to the next step.

I was a bit concerned about getting the CPU in there right. I’d heard stories of people breaking off pins, or breaking the lockdown clamps and crap like that. I guess going slowly was on my side though… it dropped right in. The only issue I had was getting the heatsink clamp to grab on both sides. I had to push A LOT harder than I expected. I was a bit nervous pushing that hard and had a friend on the phone saying, “Don’t worry man, I’ve done dozens of those and never broken one. Just push on it.” Haha… he was right. In it went.

After that it was smooth sailing. RAM went in next. Who knew RAM came with heat dissipation fins these days? Wow. Video card after that. Man that’s a big sucker. Takes two slots on the case, has its own big ol’ fan and two external power connectors.

Hard disk, DVD came last, then got into routing power and data cables. All in all it came together quite nicely I think and I would happily do it again. I do expect I’ll upgrade this next year to a double graphics setup. Since I’m using nVidia it will be SLI based which means I probably have to buy another mobo. That is the only downside to the sweet bundle deal I got. I’ll also add another 4GB RAM sometime later this year to bring me up to 8GB.

I’m running Windows7 RTM x64 which I love. Best operating system Microsoft has ever produced IMHO. WoW screams on this machine, pulling appx 75-100 fps with most of the graphics sliders turned way, way up. Here is the final setup on my desk showing the two monitors and my work laptop.

Desk showing new machine and monitors

I’m using Synergy to share my mouse and keyboard onto the laptop which effectively makes it like a third monitor without having to actually hook it up that way. (More coming on Synergy in a follow-up post.)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
28

New Gaming PC Build-out – The Order

Monday, 28 September 2009 08:28 by Peter Provost

Antec_900 I’ve been a gamer for a few years now, mostly playing World of Warcraft but also occasionally spending time on other games. I’ve never actually owned a good gaming machine, however. I’ve always played on a laptop, mostly using and external monitor, keyboard and mouse.

For a few months I’ve been considering building out a new machine from scratch. It was a bit intimidating given how long it has been since I’ve played in this space, but with the help of a few friends who know this stuff, I think I picked out a pretty good setup.

I went off to NewEgg.com and started picking parts. They’ve got lots of combo deals, reviews and spec information so they really are a great place to do this from. I also used Tom’s Hardware Guide to compare important things like CPUs and Video chipsets.

When I finally clicked BUY last night, here’s what I had decided on:

I would have liked to get a 10,000 rpm drive but I got a sweet deal on a CPU/HDD/Mobo bundle and went with it for now. I’ll also probably add 4GB RAM later to bring it up to 8GB total.

Also, I’m not really one for the glowy blue case thing, but the airflow on that case and the great reviews it gets sold me.

We’ll see… I’ll post more once I start putting it together.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
28

Two Weeks as a Caregiver

Monday, 28 September 2009 06:55 by Peter Provost

The last two weeks have been… interesting. Last month my wife Emily was diagnosed with very early breast cancer. It is simply amazing what modern imaging can find. The tumor was just a smudge on the images. A biopsy found something that was less than 1mm in side and had to get sent to Vanderbilt for diagnosis. The diagnosis was micro-invasive ductal carcinoma in her left breast.

Ugh. She’s 36.

Because of family history she opted for a double simple mastectomy with reconstruction including the sentinel node on the left side. In the weeks leading up to the surgery, as we prepared emotionally for it all, the most amazing thing happened. Meghan, Em’s sister, organized a huge operation of helpers and friends to do everything from bringing us food to picking up the kids after school. I simply can’t say enough how much we appreciate all the help our amazing friends and family gave us during this time. Thank you thank you thank you.

The surgery was two weeks ago and it went great. Sentinel node came back clear which means it didn’t spread. Woot! We spent the first night in the hospital which is fine, I’ve done that enough times. The hospital has good Wi-Fi so when Em wasn’t awake I goofed off on my laptop playing WoW or something else.

The pain levels Em experienced were a bit more than we had expected, so we had to work a bunch to get the right mix of painkillers to keep her comfortable. After going home, the game continued. As her primary caregiver, I had to figure out how to track and manage all her pills, which was a bit daunting at first. Geek that I am, I eventually came up with a cool Excel printout that I put in the bathroom.

It looked like this (I used it vertically--the time went top-to-bottom):

 Emily-Drug-Schedule

Nerdy? Yes. Effective? HELL YES! I had alarms set on my phone and on my bedside alarm clock that reminded me every time we had to do something. It was kinda nutty, but for that first week it helped immensely. One thing you don’t want to do after major surgery is fall behind on the pain. It can be almost impossible to catch up without pushing the limits on some of the drugs and it can seriously slow down recuperation if the patient is in major pain.

The other thing we had to do is what they call “strip the drains”. After the surgery, Em had two tubes coming out of her sides that went to little vacuum reservoirs to collect the fluid. Every few hours (at first) I had to drain the reservoirs and wring out the tubes to remove any clots that may have formed. Kinda yucky work, but it needed to happen. She also had a cool little “pain pump” installed that directly sent local anesthetic into the wound site via two little wiry tubes. Once the pain pump ran out, I got the job of removing the wires. I was just a bit startled how much tubing was inside her… almost 8 inches! It was kinda fun pulling them out. Hehe…

Sidenote: When you’re doing the drain stripping, be really REALLY careful to not tug on the tubes or your wife will try to kick you out of the house regardless of how much meds she has on board. You have been warned. :)

As the first week ramped down, the pain got much more under control. We started dropping off the schedule at night and went to a mode on-demand kind of thing. During the day I still tried to stick with it as best I could. The amount of fluid coming out dropped a lot during this time as well, which was good. The doctors has said we wouldn’t have the drains out until we were at less than 25cc in 24 hours. (At first we would get more than 25cc in 3 hours per side!)

During the second week, Em still spent most of her time in bed but was much more able to get up and move around the house. She was on milder pain meds too so she was a lot less loopy which she liked. We still had amazing support coming in daily from our friends and family… food, snacks, toys and kidcare. Another huge shout out to everyone who helped.

Exactly two weeks after the day of surgery we went back in to the plastic surgeon who was doing the reconstruction. Recovery was going well, swelling is low and they decided to take the drains out and add more fluid to the tissue expanders that were implanted during surgery.

“It will feel like when you had your braces tightened as a kid.” Hmmm… not too bad.

BULLSHIT! At least for Emily it was a bit more than that. She had to go back onto Vicodin for two days to get through it, but now she’s back to simpler stuff which makes us both happy.

Looking into the future we can expect them to add more saline to the expanders for a few more weeks (which Em isn’t looking forward to), then a few months to let it all settle down. After that, the expanders come out and in another surgery they replace them with traditional saline implants.

I started back to work today which is both good and bad. Good to be getting back to a sense of normalcy. Bad because I have to catch up on two weeks of shit that happened while I was gone. Oh well… things could be much worse.

In addition to all the thanks I want to heap on all those who helped us during this time, I also was to say loudly how proud I am of Emily. She has been such a trooper through all this and she amazes me every day. Emily I love you more than anything else in the world.

Currently rated 5.0 by 4 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:  
Categories:   Personal
Actions:   E-mail | del.icio.us | Permalink | Comments (4) | Comment RSSRSS comment feed
04

DSL Tools Model Bus Sample

Thursday, 4 June 2009 03:44 by Peter Provost

Visual Studio Logo Jean-Marc Prieur and Stuart Kent, fellow Team Architects who work on DSL Tools, have just posted some great new content about the new DSL ModelBus. The ModelBus enables integration across models and designers, which is something people have been asking for since DSL Tools first shipped.

Check it out:

Enjoy!

Currently rated 1.0 by 1465 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   ,
Categories:   Technology
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed
10

Fun with PowerShell and TFS Work Items

Friday, 10 April 2009 06:53 by Peter Provost

It all started with me wanting a better burndown chart for my team. That was relatively simple to solve as we’ve got some pretty good ones floating around inside Microsoft. (Apologies in advance but I can’t share my spreadsheet with you at this time.)

Then came the fun… I wanted to be able to pull any given day’s “work done” and “work remaining” data. But for my own reasons, I don’t want this spreadsheet bound to the OLAP cube, I want to be able to mess with it.

Being the PowerShell junkie that I am I was pretty sure I could do this. I found James Manning’s killer “get-tfs.ps1” script which meant I didn’t have to work out that bit myself.

Using it is simple:

   1: $tfs = get-tfs http://mytfs:8080
   2: $wi = $tfs.wit.GetWorkItem(12345)

As you can see, I get the TFS client object via James’s script, and then I pull a WorkItem from it. From there I can ask the $wi object for all the bits of information in the work item. Piping it to get-member showed me the following methods and properties:

   1:  
   2:    TypeName: Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem
   3:  
   4: Name                   MemberType            Definition                                                                
   5: ----                   ----------            ----------                                                                
   6: FieldChanged           Event                 Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemFieldChangeEve...
   7: Copy                   Method                Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem Copy(Microsof...
   8: Equals                 Method                bool Equals(System.Object obj)                                            
   9: GetHashCode            Method                int GetHashCode()                                                         
  10: GetNextState           Method                string GetNextState(string action)                                        
  11: GetType                Method                type GetType()                                                            
  12: IsValid                Method                bool IsValid()                                                            
  13: MergeToLatest          Method                System.Void MergeToLatest()                                               
  14: Open                   Method                System.Void Open()                                                        
  15: PartialOpen            Method                System.Void PartialOpen()                                                 
  16: Reset                  Method                System.Void Reset()                                                       
  17: Save                   Method                System.Void Save()                                                        
  18: SyncToLatest           Method                System.Void SyncToLatest()                                                
  19: ToString               Method                string ToString()                                                         
  20: Validate               Method                System.Collections.ArrayList Validate()                                   
  21: Item                   ParameterizedProperty System.Object Item(string name) {get;set;}, System.Object Item(Microsof...
  22: AreaId                 Property              System.Int32 AreaId {get;set;}                                            
  23: AreaPath               Property              System.String AreaPath {get;set;}                                         
  24: AttachedFileCount      Property              System.Int32 AttachedFileCount {get;}                                     
  25: Attachments            Property              Microsoft.TeamFoundation.WorkItemTracking.Client.AttachmentCollection A...
  26: ChangedBy              Property              System.String ChangedBy {get;}                                            
  27: ChangedDate            Property              System.DateTime ChangedDate {get;}                                        
  28: CreatedBy              Property              System.String CreatedBy {get;}                                            
  29: CreatedDate            Property              System.DateTime CreatedDate {get;}                                        
  30: Description            Property              System.String Description {get;set;}                                      
  31: DisplayForm            Property              System.String DisplayForm {get;}                                          
  32: ExternalLinkCount      Property              System.Int32 ExternalLinkCount {get;}                                     
  33: Fields                 Property              Microsoft.TeamFoundation.WorkItemTracking.Client.FieldCollection Fields...
  34: History                Property              System.String History {get;set;}                                          
  35: HyperLinkCount         Property              System.Int32 HyperLinkCount {get;}                                        
  36: Id                     Property              System.Int32 Id {get;}                                                    
  37: IsDirty                Property              System.Boolean IsDirty {get;}                                             
  38: IsNew                  Property              System.Boolean IsNew {get;}                                               
  39: IsOpen                 Property              System.Boolean IsOpen {get;}                                              
  40: IsPartialOpen          Property              System.Boolean IsPartialOpen {get;}                                       
  41: IsReadOnly             Property              System.Boolean IsReadOnly {get;}                                          
  42: IsReadOnlyOpen         Property              System.Boolean IsReadOnlyOpen {get;}                                      
  43: IterationId            Property              System.Int32 IterationId {get;set;}                                       
  44: IterationPath          Property              System.String IterationPath {get;set;}                                    
  45: Links                  Property              Microsoft.TeamFoundation.WorkItemTracking.Client.LinkCollection Links {...
  46: NodeName               Property              System.String NodeName {get;}                                             
  47: Project                Property              Microsoft.TeamFoundation.WorkItemTracking.Client.Project Project {get;}   
  48: Reason                 Property              System.String Reason {get;set;}                                           
  49: RelatedLinkCount       Property              System.Int32 RelatedLinkCount {get;}                                      
  50: Rev                    Property              System.Int32 Rev {get;}                                                   
  51: RevisedDate            Property              System.DateTime RevisedDate {get;}                                        
  52: Revision               Property              System.Int32 Revision {get;}                                              
  53: Revisions              Property              Microsoft.TeamFoundation.WorkItemTracking.Client.RevisionCollection Rev...
  54: State                  Property              System.String State {get;set;}                                            
  55: Store                  Property              Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore Store {g...
  56: TemporaryId            Property              System.Int32 TemporaryId {get;}                                           
  57: Title                  Property              System.String Title {get;set;}                                            
  58: Type                   Property              Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemType Type {get;} 
  59: Uri                    Property              System.Uri Uri {get;}                                                     
  60: WorkItemLinkHistory    Property              Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemLinkCollection...
  61: WorkItemLinks          Property              Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemLinkCollection...
  62: GetCompletedWorkByDate ScriptMethod          System.Object GetCompletedWorkByDate();                                   
  63: GetRemainingWorkByDate ScriptMethod          System.Object GetRemainingWorkByDate();                                   

Lots of great stuff there, but what I really wanted was the work done on any given day and not the current work remaining. Hmmm…

After digging around in the object model (with PowerShell of course), I found the answer. The Revisions collection contains the full history of the Work Item. If I enumerated that, looking at the dates, I should be able to get what I want.

A little while later I had it all worked out, setup as a type extension in PowerShell so it automatically works with every WorkItem type I get. Type extensions are added via a special XML file (more info). Here’s what I added to mine:

   1: <Type>
   2:     <Name>Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem</Name>
   3:     <Members>
   4:         <ScriptMethod>
   5:             <Name>GetCompletedWorkByDate</Name>
   6:             <Script>
   1:  
   2:                 $date = [datetime] $args[0]
   3:                 $total = 0
   4:                 $this.Revisions | % {
   5:                     if ($_.Fields['Changed Date'].Value.Date -eq $date) {
   6:                         $work = $_.Fields["Completed Work"]
   7:                         if ($work -ne $null) { $total += ([int] $work.Value) - ([int] $work.OriginalValue) }
   8:                     }
   9:                 }
  10:                 return $total
  11:             
</Script>
   7:         </ScriptMethod>
   8:         <ScriptMethod>
   9:             <Name>GetRemainingWorkByDate</Name>
  10:             <Script>
   1:  
   2:                 $date = [datetime] $args[0]
   3:                 $total = 0
   4:                 $this.Revisions | % {
   5:                     if ($_.Fields['Changed Date'].Value.Date -le $date) {
   6:                         $work = $_.Fields["Remaining Work"]
   7:                         if ($work -ne $null) {
   8:                             $total = ([int] $work.Value)
   9:                         }
  10:                     }
  11:                 }
  12:                 return $total
  13:             
</Script>
  11:         </ScriptMethod>
  12:     </Members>
  13: </Type>

What this does is add two new methods to the .NET type Microsoft.TeamFoundation.WorkItemTracking.Client.Workitem. The first method takes a date and returns the sum of the “Completed Work” field for all revisions that occurred on that date. The second method enumerates the same Revisions collection, but this time it process all revisions up through the given date looking for the last one that says anything about the “Remaining Work” field.

Next step… create a script to wrap all this up into an easy to use command I call get-burndowndata.ps1:

   1: param( 
   2:         $deliverable = $(throw "Must provide deliverable ID"),
   3:         $date = [datetime]::Now.Date 
   4: )
   5:  
   6: $tfs = get-tfs http://mytfs:8080
   7: $deliverable = $tfs.WIT.GetWorkItem($deliverable) 
   8:  
   9: $result = @()
  10:  
  11: $deliverable.WorkItemLinks | ? { $_.LinkType.Name -eq "Child" } | % {
  12:     $feature = $tfs.WIT.GetWorkItem($_.TargetId)
  13:  
  14:     $feature.WorkItemLinks | ? { $_.LinkType.Name -eq "Child" } | % {
  15:         $task = $tfs.WIT.GetWorkItem($_.TargetId)
  16:         $completed = $task.GetCompletedWorkByDate($date)
  17:         $remaining = $task.GetRemainingWorkByDate($date)
  18:  
  19:         $obj = "" | select-object ID, Title, Completed, Remaining 
  20:         $obj.ID = $task.ID
  21:         $obj.Title = $task.Title
  22:         $obj.Completed = $completed
  23:         $obj.Remaining = $remaining
  24:  
  25:         $result += $obj
  26:     }
  27: }
  28:  
  29: $result

Now, getting any given day’s burndown information is as simple as calling that script and opening the result in Excel:

   1: get-burndowndata.ps1 12345 "4/1/2009" | export-csv data_20090401.csv
   2: invoke-item data_20090401.csv

Works like a charm!

Disclaimer: The get-burndowndata.ps1 script makes lots of assumptions about your TFS Work Item struction and relationships . It probably won’t work unmodified for anyone outside of DevDiv.

Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
02

Enterprise Library v5.0 Planning Has Begun!

Monday, 2 February 2009 02:17 by Peter Provost

PAG_Logo_NoText Way back in 2004, sitting in the “delta lounge” team room with Scott, Brian, Ed, T-Shak, Rohit, Prashant and Mani, I never would have believed that almost 5 years later, we’d still be shipping Enterprise Library (aka EntLib) or that we’d be up to version 5.0.

A few days ago, my good friend Grigori Melnik, who is the PM for EntLib over in Patterns & Practices, sent me an email reminding me that they are looking for planning input on the version 5.0 features.

He’s written it all up over on his blog:
http://blogs.msdn.com/agile/archive/2009/01/26/enterprise-library-5-what-s-on-your-wish-list.aspx

If you are a current or past EntLib user, please don’t miss this opportunity to help steer the product. As I tell my wife, “If you don’t tell me what you want, you shouldn’t expect me to get you the right thing.”

Currently rated 1.0 by 835 people

  • Currently 1.011976/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
29

Rules of the Road

Thursday, 29 January 2009 03:24 by Peter Provost

http://realestatetomato.typepad.com/the_real_estate_tomato/F_St.jpgI was digging through my OneNote today, organizing stuff and reading old notes and whatnot, when I found a page I wrote on 7/13/2006. I don’t know why I wrote it in OneNote, but it is something I’ve talked about to my direct reports, colleagues and others for a long time.

It was simply titled “Rules of the Road” and had the following content:

  1. Don't stress out about things you can't control - ignore them
  2. Don't stress out about things you can control - fix them
  3. Confront someone as soon as you recognize the problem - don't let it fester!
  4. Help people who sincerely ask for help
  5. Fight for what you believe in
  6. Admit when you are wrong
  7. Reserve the right to change your mind
  8. You do NOT have to justify saying no to someone

My dad taught my 1-3 when I was growing up. He had ulcer issues as a younger man because he let stress build up too much. Those rules help you get grounded when you feel stressed and show you simple ways out, even when, as in Rule #1, the out is to ignore the issue.

Numbers 4-5 are extensions I’ve added over time to help me guide my life. Help your friends. Admit when you make a mistake. Do not be afraid to change your mind. Don’t let other people convince you that “flip flopping” in the presence of new information is somehow bad. When you know better, do better.

The final one is the newest addition to the family. Sometimes many people, when presented with a request they has to say no to, will seek a rationalization or a story that they can use to justify saying no. Here’s the thing… you don’t have to justify saying No. You shouldn’t be rude, you should be always polite and respectful, but you can just say, “No, I’m sorry but I can’t,” and leave it at that.

Currently rated 1.0 by 3831 people

  • Currently 1.013052/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
26

Elegant Code Interview

Monday, 26 January 2009 09:16 by Peter Provost

A few weeks ago I was invited by the folks over at Elegant Code to do an interview about myself, agile and the stuff I’m working on in VSTS. The podcast for that went live today:

http://elegantcode.com/2009/01/26/code-cast-19-peter-provost-on-agile-visual-studio-2010-and-architecture-tools/

Enjoy!

Currently rated 1.0 by 1920 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5